Readers
readers
#
Functions:
Name | Description |
---|---|
read_dicom_auto |
General DICOM reader that dispatches to the correct class based on modality. |
read_dicom_series |
Read DICOM series as SimpleITK Image. |
read_dicom_auto
#
read_dicom_auto(
path: str,
modality: typing.Optional[str] = None,
**kwargs: typing.Any
) -> imgtools.io.readers.MedImageT
General DICOM reader that dispatches to the correct class based on modality.
This function automatically determines the appropriate class based on the modality and calls its from_dicom method with the provided arguments.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
Path to the DICOM file or directory containing DICOM files. |
required |
|
str
|
Explicitly specify the modality. If None, the function will try to determine the modality from the DICOM metadata. |
None
|
|
typing.Any
|
Additional keyword arguments to pass to the specific from_dicom method. Common parameters include: - series_id: str | None - Series ID for DICOM series - recursive: bool - Whether to search recursively for DICOM files - file_names: list[str] | None - Specific file names to read - pet_image_type: For PET images, specify SUV or ACT |
{}
|
Returns:
Type | Description |
---|---|
imgtools.io.readers.MedImageT
|
The loaded image or mask object of the appropriate type. |
Source code in src/imgtools/io/readers.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
|
read_dicom_series
#
read_dicom_series(
path: str,
series_id: str | None = None,
recursive: bool = False,
file_names: list[str] | None = None,
**kwargs: typing.Any
) -> tuple[SimpleITK.Image, dict]
Read DICOM series as SimpleITK Image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
Path to directory containing the DICOM series. |
required |
|
bool
|
Whether to recursively parse the input directory when searching for DICOM series, |
False
|
|
bool
|
Whether to recursively parse the input directory when searching for DICOM series, |
False
|
|
str | None
|
Specifies the DICOM series to load if multiple series are present in the directory. If None and multiple series are present, loads the first series found. |
None
|
|
str | None
|
Specifies the DICOM series to load if multiple series are present in the directory. If None and multiple series are present, loads the first series found. |
None
|
|
list[str] | None
|
If there are multiple acquisitions/"subseries" for an individual series, use the provided list of file_names to set the ImageSeriesReader. |
None
|
|
list[str] | None
|
If there are multiple acquisitions/"subseries" for an individual series, use the provided list of file_names to set the ImageSeriesReader. |
None
|
Returns:
Type | Description |
---|---|
image
|
SimpleITK Image object containing the DICOM series. |
metadata
|
Dictionary containing metadata extracted from one file in the series. |