dicom2nifti.convert_dicom module¶
dicom2nifti
@author: abrys
-
class
dicom2nifti.convert_dicom.
Vendor
[source]¶ Bases:
object
Enum with the vendor
-
GE
= 2¶
-
GENERIC
= 0¶
-
HITACHI
= 4¶
-
PHILIPS
= 3¶
-
SIEMENS
= 1¶
-
-
dicom2nifti.convert_dicom.
are_imaging_dicoms
(dicom_input)[source]¶ This function will check the dicom headers to see which type of series it is Possibilities are fMRI, DTI, Anatomical (if no clear type is found anatomical is used)
Parameters: dicom_input – directory with dicom files or a list of dicom objects
-
dicom2nifti.convert_dicom.
dicom_array_to_nifti
(dicom_list, output_file, reorient_nifti=True)[source]¶ Converts dicom single series (see pydicom) to nifty, mimicking SPM
Examples: See unit test
will return a dictionary containing - the NIFTI under key ‘NIFTI’ - the NIFTI file path under ‘NII_FILE’ - the BVAL file path under ‘BVAL_FILE’ (only for dti) - 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
Parameters: - reorient_nifti – if True the nifti affine and data will be updated so the data is stored LAS oriented
- output_file – file path to write to
- dicom_list – list with uncompressed dicom objects as read by pydicom
-
dicom2nifti.convert_dicom.
dicom_series_to_nifti
(original_dicom_directory, output_file=None, reorient_nifti=True)[source]¶ Converts dicom single series (see pydicom) to nifty, mimicking SPM
Examples: See unit test
will return a dictionary containing - the NIFTI under key ‘NIFTI’ - the NIFTI file path under ‘NII_FILE’ - the BVAL file path under ‘BVAL_FILE’ (only for dti) - 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
Parameters: - reorient_nifti – if True the nifti affine and data will be updated so the data is stored LAS oriented
- output_file – file path to write to if not set to None
- original_dicom_directory – directory with the dicom files for a single series/scan
:return nibabel image