cleanX.dicom_processing.pydicom_adapter module¶
- class cleanX.dicom_processing.pydicom_adapter.PydicomDicomReader(exclude_field_types=None, date_fields=None, time_fields=None, exclude_fields=None)¶
Bases:
object
Class for reading DICOM metadata with pydicom.
- __init__(exclude_field_types=None, date_fields=None, time_fields=None, exclude_fields=None)¶
Initializes the reader with some filtering options.
- Parameters:
exclude_field_types (Sequence[type]) –
Some DICOM types have internal structure difficult to represent in a dataframe. These are filtered by default:
bytes
(this is usually the image data)
date_fields (Sequence[str]) – Fields that should be interpreted as having date information in them.
time_fields (Sequence[str]) – Fields that should be interpreted as having time information in them.
exclude_fields (Sequence[str]) – Fields to exclude (in addition to those selected by
exclude_field_types
- exclude_field_types = (<class 'pydicom.sequence.Sequence'>, <class 'pydicom.multival.MultiValue'>, <class 'bytes'>)¶
Default types of fields not to be included in the dataframe produced from parsed DICOM files.
- date_fields = ('ContentDate', 'SeriesDate', 'ContentDate', 'StudyDate')¶
Default DICOM tags that should be interpreted as containing date information.
- time_fields = ('ContentTime', 'StudyTime')¶
Default DICOM tags that should be interpreted as containing datetime information.
- exclude_fields = ()¶
Default tags to be excluded from genrated
DataFrame
for any other reason.
- dicom_time_to_time(source)¶
Utility method to help translate DICOM date and time objects to python
datetime
.Warning
This isn’t implemented yet. Needs research on DICOM time representation.
- rip_out_jpgs(source, destination)¶
Extract image data from DICOM files and save it as JPG in
destination
.- Parameters:
source (
Source
) – A source generator. For extended explanation seeSource
.destination (Compatible with
os.path.join()
) – The name of the directory where JPG files should be stored.
- cleanX.dicom_processing.pydicom_adapter.get_jpg_with_pydicom(dicom_folder_path, jpg_folder_path)¶
This function is for users with pydicom library only. If you do not have the library it will throw an error. The function function jpeg files out of a dicom file directory, one by one, each of them (not just the first series as), and puts them in an out put directory.