Series Information Module#
Module: pyradise.fileio.series_info
General#
The series_info
module provides functionality to hold and retrieve information about data
entities which are required during the loading procedure for Subject
and
Image
creation. The base class of this module is the SeriesInfo
which is named
in accordance with the DICOM Standard because it manages information about a single data entity (e.g. a DICOM-RTSS) or
a series of associated data entities (e.g. a series of image slices). For each supported type of data this module
provides separate classes because the information required for loading varies between the different types of data.
The SeriesInfo
instances are typically generated automatically during crawling (see
Crawling Module) and render the selection (see Selection Module)
of appropriate SeriesInfo
instances feasible before executing the time consuming loading procedure. This is
especially useful if the user wants to process specific data exclusively and wants to keep the computation time and
the memory footprint low. Afterwards, the SeriesInfo
instances are used to load the data (see
Loading Module) and to create the Subject
instance.
Class Overview#
The following SeriesInfo
classes are provided:
Class |
Description |
---|---|
Base class for all |
|
Base class for all discrete image file format |
|
Base class for all DICOM format |
|
|
|
|
|
|
|
|
|
|
Details#
- class SeriesInfo(path)[source]#
Bases:
ABC
An abstract base class for all
SeriesInfo
classes. ASeriesInfo
class is used to retrieve and store content-specific information which is required by theSubjectLoader
in order to correctly load the data and to construct aSubject
.Depending on the type of data, the
SeriesInfo
subclasses retrieve different information which is essential for loading andSubject
construction. For example, theDicomSeriesImageInfo
retrieves and holds data about theModality
whereas theDicomSeriesRTSSInfo
manages information about theAnnotator
and information about the referenced DICOM image series.- Parameters:
path (Union[str, Tuple[str, ...]]) – The path or paths to the files to load.
- get_path()[source]#
Get the file paths assigned to the
SeriesInfo
instance.- Returns:
The file paths assigned to the
SeriesInfo
instance.- Return type:
Tuple[str]
- is_updated()[source]#
Check if is updated.
- Returns:
True if is updated, False otherwise.
- Return type:
bool
- abstract update()[source]#
Update the
SeriesInfo
instance.- Return type:
None
- Returns:
None
- class FileSeriesInfo(path, subject_name)[source]#
Bases:
SeriesInfo
An abstract base
SeriesInfo
class for all discrete image files (e.g. NIFTI, NRRD, MHA, etc.).Important
For DICOM files use a
DicomSeriesInfo
subclass instead.- Parameters:
path (str) – The path to the discrete image file to load.
subject_name (str) – The name of the subject.
- abstract update()[source]#
Update the
FileSeriesInfo
instance.- Return type:
None
- Returns:
None
- get_path()#
Get the file paths assigned to the
SeriesInfo
instance.- Returns:
The file paths assigned to the
SeriesInfo
instance.- Return type:
Tuple[str]
- get_patient_id()#
Get the patient ID.
- Returns:
The patient ID.
- Return type:
str
- get_patient_name()#
Get the patient name.
- Returns:
The patient name.
- Return type:
str
- is_updated()#
Check if is updated.
- Returns:
True if is updated, False otherwise.
- Return type:
bool
- class IntensityFileSeriesInfo(path, subject_name, modality)[source]#
Bases:
FileSeriesInfo
A
FileSeriesInfo
class for intensity images. In addition to the information provided by theFileSeriesInfo
class, this class contains also aModality
instance.- Parameters:
path (str) – The path to the discrete intensity image file to load.
subject_name (str) – The name of the subject.
modality (Union[str, Modality]) – The modality of the intensity image.
- update()[source]#
Update the
IntensityFileSeriesInfo
.- Return type:
None
- Returns:
None
- get_path()#
Get the file paths assigned to the
SeriesInfo
instance.- Returns:
The file paths assigned to the
SeriesInfo
instance.- Return type:
Tuple[str]
- get_patient_id()#
Get the patient ID.
- Returns:
The patient ID.
- Return type:
str
- get_patient_name()#
Get the patient name.
- Returns:
The patient name.
- Return type:
str
- is_updated()#
Check if is updated.
- Returns:
True if is updated, False otherwise.
- Return type:
bool
- class SegmentationFileSeriesInfo(path, subject_name, organ, annotator)[source]#
Bases:
FileSeriesInfo
A
FileSeriesInfo
class for segmentation images. In addition to the information provided by theFileSeriesInfo
class, this class contains also anOrgan
instance and aAnnotator
instance.Note
We assume that the segmentation image is a binary image with the foreground having the value 1 and the background being 0. If your images are different we recommend to separate the segmentation masks into separate files because in RT practice segmentations may overlap.
- Parameters:
- update()[source]#
Update the
SegmentationFileSeriesInfo
instance.- Return type:
None
- Returns:
None
- get_path()#
Get the file paths assigned to the
SeriesInfo
instance.- Returns:
The file paths assigned to the
SeriesInfo
instance.- Return type:
Tuple[str]
- get_patient_id()#
Get the patient ID.
- Returns:
The patient ID.
- Return type:
str
- get_patient_name()#
Get the patient name.
- Returns:
The patient name.
- Return type:
str
- is_updated()#
Check if is updated.
- Returns:
True if is updated, False otherwise.
- Return type:
bool
- class DicomSeriesInfo(path)[source]#
Bases:
SeriesInfo
An abstract base
SeriesInfo
class for all DICOM data (i.e. DICOM image, DICOM registration, DICOM-RTSS).Important
For discrete image files use a
FileSeriesInfo
subclass instead.- Parameters:
path (Union[str, Tuple[str, ...]]) – The path or paths specifying DICOM files to load.
- abstract update()[source]#
Update the
DicomSeriesInfo
instance.- Return type:
None
- Returns:
None
- get_path()#
Get the file paths assigned to the
SeriesInfo
instance.- Returns:
The file paths assigned to the
SeriesInfo
instance.- Return type:
Tuple[str]
- get_patient_id()#
Get the patient ID.
- Returns:
The patient ID.
- Return type:
str
- get_patient_name()#
Get the patient name.
- Returns:
The patient name.
- Return type:
str
- is_updated()#
Check if is updated.
- Returns:
True if is updated, False otherwise.
- Return type:
bool
- class DicomSeriesImageInfo(paths)[source]#
Bases:
DicomSeriesInfo
A
DicomSeriesInfo
class for DICOM images. In addition to the information provided by theDicomSeriesInfo
class, this class contains also aModality
instance.- Parameters:
paths (Tuple[str, ...]) – The paths to the DICOM image files to load.
- update()[source]#
Update the
DicomSeriesImageInfo
instance.- Return type:
None
- Returns:
None
- get_path()#
Get the file paths assigned to the
SeriesInfo
instance.- Returns:
The file paths assigned to the
SeriesInfo
instance.- Return type:
Tuple[str]
- get_patient_id()#
Get the patient ID.
- Returns:
The patient ID.
- Return type:
str
- get_patient_name()#
Get the patient name.
- Returns:
The patient name.
- Return type:
str
- is_updated()#
Check if is updated.
- Returns:
True if is updated, False otherwise.
- Return type:
bool
- class DicomSeriesDoseInfo(paths)[source]#
Bases:
DicomSeriesImageInfo
A
DicomSeriesDoseInfo
class for DICOM Dose images. In addition to the information provided by theDicomSeriesImageInfo
class, this class contains a flag to indicate the image is a Dose volume.- Parameters:
paths (Tuple[str, ...]) – The paths to the DICOM image files to load.
- get_path()#
Get the file paths assigned to the
SeriesInfo
instance.- Returns:
The file paths assigned to the
SeriesInfo
instance.- Return type:
Tuple[str]
- get_patient_id()#
Get the patient ID.
- Returns:
The patient ID.
- Return type:
str
- get_patient_name()#
Get the patient name.
- Returns:
The patient name.
- Return type:
str
- is_updated()#
Check if is updated.
- Returns:
True if is updated, False otherwise.
- Return type:
bool
- update()#
Update the
DicomSeriesImageInfo
instance.- Return type:
None
- Returns:
None
- class DicomSeriesRegistrationInfo(path, image_infos, persistent_image_infos=False)[source]#
Bases:
DicomSeriesInfo
A
DicomSeriesInfo
class for DICOM registrations. In addition to the information provided by theDicomSeriesInfo
class, this class contains transformation parameters and references to the pair of DICOM images associated with the registration.- Parameters:
path (str) – The path to the DICOM registration file to load.
image_infos (Tuple[DicomSeriesImageInfo, ...]) – The
DicomSeriesImageInfo
used.persistent_image_infos (bool) – If True the class holds to the image_infos after updating, otherwise not (default: False).
- static get_referenced_series_info(registration_dataset)[source]#
Get the
ReferenceInfo
entries from a dataset.- Parameters:
registration_dataset (Dataset) – The registration dataset to extract the infos from.
- Returns:
The
ReferenceInfo
retrieved from the Dataset.- Return type:
Tuple[ReferenceInfo, …]
- static get_registration_infos(registration_dataset, image_infos)[source]#
Extract the
RegistrationInfo
entries with the correspondingReferenceInfo
.- Parameters:
registration_dataset (Dataset) – The registration dataset to extract the registration infos from.
image_infos (Union[Tuple[DicomSeriesImageInfo, ...], Tuple[Dataset, ...]]) – The image infos or datasets to use for the combination.
- Returns:
The combined
RegistrationInfo
.- Return type:
Tuple[RegistrationInfo, …]
- set_image_infos(image_infos)[source]#
Set the
DicomSeriesImageInfo
entries.- Parameters:
image_infos (Tuple[DicomSeriesImageInfo, ...]) – The
DicomSeriesImageInfo
entries to set.- Return type:
None
- Returns:
None
- get_image_infos()[source]#
Get the
DicomSeriesImageInfo
entries.- Returns:
The
DicomSeriesImageInfo
entries.- Return type:
Tuple[DicomSeriesImageInfo, …]
- update()[source]#
Update the
DicomSeriesRegistrationInfo
.- Return type:
None
- Returns:
None
- get_path()#
Get the file paths assigned to the
SeriesInfo
instance.- Returns:
The file paths assigned to the
SeriesInfo
instance.- Return type:
Tuple[str]
- get_patient_id()#
Get the patient ID.
- Returns:
The patient ID.
- Return type:
str
- get_patient_name()#
Get the patient name.
- Returns:
The patient name.
- Return type:
str
- is_updated()#
Check if is updated.
- Returns:
True if is updated, False otherwise.
- Return type:
bool
- class DicomSeriesRTSSInfo(path)[source]#
Bases:
DicomSeriesInfo
A
DicomSeriesInfo
class for DICOM-RTSS. In addition to the information provided by theDicomSeriesInfo
class, this class contains aAnnotator
instance and a reference to the DICOM image associated with the DICOM-RTSS.- Parameters:
path (str) – The path to the DICOM-RTSS file to load.
- get_path()#
Get the file paths assigned to the
SeriesInfo
instance.- Returns:
The file paths assigned to the
SeriesInfo
instance.- Return type:
Tuple[str]
- get_patient_id()#
Get the patient ID.
- Returns:
The patient ID.
- Return type:
str
- get_patient_name()#
Get the patient name.
- Returns:
The patient name.
- Return type:
str
- is_updated()#
Check if is updated.
- Returns:
True if is updated, False otherwise.
- Return type:
bool
- update()[source]#
Update the
DicomSeriesRTSSInfo
.- Return type:
None
- Returns:
None
- class ReferenceInfo(series_instance_uid, study_instance_uid, is_same_study)[source]#
Bases:
object
A class storing one of multiple reference infos from a DICOM registration file.
Warning
This class is intended for internal use only.
- Parameters:
series_instance_uid (str) – The SeriesInstanceUID.
study_instance_uid (str) – The StudyInstanceUID.
is_same_study (bool) – Indicates if the series is from the same study as the reference.
- class RegistrationInfo(registration_info, reference_info, is_reference_image)[source]#
Bases:
object
A class storing all necessary infos for applying a registration transformation to a DICOM image.
Warning
This class is intended for internal use only.
- Parameters:
registration_info (RegistrationSequenceInfo) – The registration sequence info.
reference_info (ReferenceInfo) – The reference info.
is_reference_image (bool) – Indicates if the image is the reference image.
- class RegistrationSequenceInfo(frame_of_reference_uid, transforms, transform_parameters)[source]#
Bases:
object
A class storing one of multiple registration sequence infos from a DICOM registration file.
Warning
This class is intended for internal use only.
- Parameters:
frame_of_reference_uid (str) – The FrameOfReferenceUID.
transforms (Tuple[sitk.AffineTransform, ...]) – The transforms.
transform_parameters (Tuple[List, ...]) – The transformation parameters.