pytomography.io.shared
#
Shared functionality between different imaging modalities.
Submodules#
Package Contents#
Functions#
|
Creates a new DICOM dataset based on a reference dataset with all required headers. Because this is potentially used to save images corresponding to different modalities, the UIDs must be input arguments to this function. In addition, since some modalities require saving multiple slices whereby |
|
Finds the first entry in an Interfile with the string |
|
Opens attenuation data from SIMIND output |
- pytomography.io.shared.create_ds(reference_ds, SOP_instance_UID, SOP_class_UID, modality)[source]#
Creates a new DICOM dataset based on a reference dataset with all required headers. Because this is potentially used to save images corresponding to different modalities, the UIDs must be input arguments to this function. In addition, since some modalities require saving multiple slices whereby
SOP_instance_UIDs
may use some convention to specify slice number, these are also input arguments.- Parameters:
reference_ds (FileDataset) – Dataset from which to copy all important headers such as patient information and study UID.
SOP_instance_UID (str) – Unique identifier for the particular instance (this is different for every DICOM file created)
SOP_class_UID (str) – Unique identifier for the imaging modality
modality (str) – String specifying imaging modality
- Returns:
_description_
- Return type:
_type_
- pytomography.io.shared.get_header_value(list_of_attributes, header, dtype=np.float32, split_substr=':=', split_idx=-1, return_all=False)[source]#
Finds the first entry in an Interfile with the string
header
- Parameters:
list_of_attributes (list[str]) – Simind data file, as a list of lines.
header (str) – The header looked for
dtype (type, optional) – The data type to be returned corresponding to the value of the header. Defaults to np.float32.
- Returns:
The value corresponding to the header (header).
- Return type:
float|str|int
- pytomography.io.shared.get_attenuation_map_interfile(headerfile)[source]#
Opens attenuation data from SIMIND output
- Parameters:
headerfile (str) – Path to header file
- Returns:
Tensor containing attenuation map required for attenuation correction in SPECT/PET imaging.
- Return type:
torch.Tensor[batch_size, Lx, Ly, Lz]