# Path: dicom2nifti/convert_hitachi.py
# def dicom_to_nifti(dicom_input, output_file=None):
# 
# Path: dicom2nifti/exceptions.py
# class ConversionValidationError(Exception):
#     """
#     Custom error type to distinguish between know validations and script errors
#     """
# 
#     def __init__(self, message):
#         # Call the base class constructor with the parameters it needs
#         super(ConversionValidationError, self).__init__(message)
# 
# class ConversionError(Exception):
#     """
#     Custom error type to distinguish between know validations and script errors
#     """
# 
#     def __init__(self, message):
#         # Call the base class constructor with the parameters it needs
#         super(ConversionError, self).__init__(message)


import logging
import dicom2nifti.compressed_dicom as compressed_dicom
import os
import tempfile
import shutil
import dicom2nifti.convert_generic as convert_generic
import dicom2nifti.convert_siemens as convert_siemens
import dicom2nifti.convert_ge as convert_ge
import dicom2nifti.convert_philips as convert_philips
import dicom2nifti.common as common
import dicom2nifti.image_reorientation as image_reorientation
import dicom2nifti.settings as settings
import dicom2nifti.resample as resample
from dicom2nifti import convert_hitachi
from pydicom.tag import Tag
from dicom2nifti.exceptions import ConversionValidationError, ConversionError
    - the BVEC file path under 'BVEC_FILE' (only for dti)

    IMPORTANT:
    If no specific sequence type can be found it will default to anatomical and try to convert.
    You should check that the data you are trying to convert is supported by this code

    Inspired by http://nipy.sourceforge.net/nibabel/dicom/spm_dicom.html
    Inspired by http://code.google.com/p/pydicom/source/browse/source/dicom/contrib/pydicom_series.py

    :param reorient_nifti: if True the nifti affine and data will be updated so the data is stored LAS oriented
    :param output_file: file path to write to
    :param dicom_list: list with uncompressed dicom objects as read by pydicom
    """
    # copy files so we can can modify without altering the original
    if not are_imaging_dicoms(dicom_list):
        raise ConversionValidationError('NON_IMAGING_DICOM_FILES')

    vendor = _get_vendor(dicom_list)

    if vendor == Vendor.GENERIC:
        results = convert_generic.dicom_to_nifti(dicom_list, output_file)
    elif vendor == Vendor.SIEMENS:
        results = convert_siemens.dicom_to_nifti(dicom_list, output_file)
    elif vendor == Vendor.GE:
        results = convert_ge.dicom_to_nifti(dicom_list, output_file)
    elif vendor == Vendor.PHILIPS:
        results = convert_philips.dicom_to_nifti(dicom_list, output_file)
    elif vendor == Vendor.HITACHI:
        results = convert_hitachi.dicom_to_nifti(dicom_list, output_file)
    else:

# Path: dicom2nifti/convert_hitachi.py
# def dicom_to_nifti(dicom_input, output_file=None):
# 
# Path: dicom2nifti/exceptions.py
# class ConversionValidationError(Exception):
#     """
#     Custom error type to distinguish between know validations and script errors
#     """
# 
#     def __init__(self, message):
#         # Call the base class constructor with the parameters it needs
#         super(ConversionValidationError, self).__init__(message)
# 
# class ConversionError(Exception):
#     """
#     Custom error type to distinguish between know validations and script errors
#     """
# 
#     def __init__(self, message):
#         # Call the base class constructor with the parameters it needs
#         super(ConversionError, self).__init__(message)


# Path: dicom2nifti/convert_dicom.py
import logging
import dicom2nifti.compressed_dicom as compressed_dicom
import os
import tempfile
import shutil
import dicom2nifti.convert_generic as convert_generic
import dicom2nifti.convert_siemens as convert_siemens
import dicom2nifti.convert_ge as convert_ge
import dicom2nifti.convert_philips as convert_philips
import dicom2nifti.common as common
import dicom2nifti.image_reorientation as image_reorientation
import dicom2nifti.settings as settings
import dicom2nifti.resample as resample
from dicom2nifti import convert_hitachi
from pydicom.tag import Tag
from dicom2nifti.exceptions import ConversionValidationError, ConversionError

    - the BVEC file path under 'BVEC_FILE' (only for dti)

    IMPORTANT:
    If no specific sequence type can be found it will default to anatomical and try to convert.
    You should check that the data you are trying to convert is supported by this code

    Inspired by http://nipy.sourceforge.net/nibabel/dicom/spm_dicom.html
    Inspired by http://code.google.com/p/pydicom/source/browse/source/dicom/contrib/pydicom_series.py

    :param reorient_nifti: if True the nifti affine and data will be updated so the data is stored LAS oriented
    :param output_file: file path to write to
    :param dicom_list: list with uncompressed dicom objects as read by pydicom
    """
    # copy files so we can can modify without altering the original
    if not are_imaging_dicoms(dicom_list):
        raise ConversionValidationError('NON_IMAGING_DICOM_FILES')

    vendor = _get_vendor(dicom_list)

    if vendor == Vendor.GENERIC:
        results = convert_generic.dicom_to_nifti(dicom_list, output_file)
    elif vendor == Vendor.SIEMENS:
        results = convert_siemens.dicom_to_nifti(dicom_list, output_file)
    elif vendor == Vendor.GE:
        results = convert_ge.dicom_to_nifti(dicom_list, output_file)
    elif vendor == Vendor.PHILIPS:
        results = convert_philips.dicom_to_nifti(dicom_list, output_file)
    elif vendor == Vendor.HITACHI:
        results = convert_hitachi.dicom_to_nifti(dicom_list, output_file)
    else:

        raise ConversionValidationError("UNSUPPORTED_DATA")