read_dicoms#
- medicalimageanalysis.read_dicoms(folder_path=None, file_list=None, exclude_files=None, only_tags=False, only_modality=None, only_load_roi_names=None, clear=True)[source]
Load DICOM files using DicomReader.
- Parameters:
folder_path (str | None) – Path to a folder containing DICOM files or subfolders with dicom files.
file_list (list[str] | None) – Explicit list of file paths to load.
exclude_files (list[str] | None) – Files to exclude from loading.
only_tags (bool) – If True, only load DICOM metadata tags.
only_modality (list[str] | None) – Modalities to include. Example: [‘CT’, ‘MR’, ‘PT’, ‘RTSTRUCT’]
only_load_roi_names (list[str] | None) – Specific ROI names to load from RTSTRUCT files.
clear (bool) – If True, clear existing loaded DICOM data before loading.
- Return type:
None
Examples
Load all DICOMs from a folder:
>>> read_dicoms(folder_path='C:/Data/Patient01')
Load specific files only:
>>> files = [ ... 'C:/Data/image_001.dcm', ... 'C:/Data/image_002.dcm', ... ] >>> read_dicoms(file_list=files)
Load only RTSTRUCT files:
>>> read_dicoms( ... folder_path='C:/Data', ... only_modality=['CT'], ... )