pytomography.io.shared.dicom#
Module Contents#
Functions#
|
Computes an affine matrix corresponding the coordinate system of a CT DICOM file. Note that since CT scans consist of many independent DICOM files, ds corresponds to an individual one of these files. This is why the maximum z value is also required (across all seperate independent DICOM files). |
|
Obtain the affine matrix from a 3D medical image stored in a single file. |
|
Given a list of seperate DICOM files, opens them up and stacks them together into a single CT image. |
|
Opens data from a single DICOM file. |
Obtains the maximum z-location from a list of DICOM slice files |
|
Obtains the minimum z-location from a list of DICOM slice files |
|
Compute the slice thickness for files that make up a scan. Though this information is often contained in the DICOM file, it is sometimes inconsistent with the ImagePositionPatient attribute, which gives the true location of the slices. |
|
|
- pytomography.io.shared.dicom._get_affine_multifile(files)[source]#
Computes an affine matrix corresponding the coordinate system of a CT DICOM file. Note that since CT scans consist of many independent DICOM files, ds corresponds to an individual one of these files. This is why the maximum z value is also required (across all seperate independent DICOM files).
- Parameters:
ds (Dataset) – DICOM dataset of CT data
max_z (float) – Maximum value of z across all axial slices that make up the CT scan
files (Sequence[str]) –
- Returns:
Affine matrix corresponding to CT scan.
- Return type:
np.array
- pytomography.io.shared.dicom._get_affine_single_file(filename)[source]#
Obtain the affine matrix from a 3D medical image stored in a single file.
- Parameters:
filename (str) – Path of file
- Returns:
Affine matrix
- Return type:
np.array
- pytomography.io.shared.dicom.open_multifile(files, return_object_meta=False)[source]#
Given a list of seperate DICOM files, opens them up and stacks them together into a single CT image.
- Parameters:
files (Sequence[str]) – List of CT DICOM filepaths corresponding to different z slices of the same scan.
return_object_meta (bool) – Whether or not to return object metadata corresponding to opened file
- Returns:
CT scan in units of Hounsfield Units at the effective CT energy.
- Return type:
np.array
- pytomography.io.shared.dicom.open_singlefile(file)[source]#
Opens data from a single DICOM file.
- Parameters:
file (str) – Filepath
- Returns:
3D Image
- Return type:
torch.Tensor
- pytomography.io.shared.dicom.compute_max_slice_loc_multifile(files)[source]#
Obtains the maximum z-location from a list of DICOM slice files
- Parameters:
files (Sequence[str]) – List of DICOM filepaths corresponding to different z slices of the same scan.
- Returns:
Maximum z location
- Return type:
float
- pytomography.io.shared.dicom.compute_min_slice_loc_multifile(files)[source]#
Obtains the minimum z-location from a list of DICOM slice files
- Parameters:
files (Sequence[str]) – List of DICOM filepaths corresponding to different z slices of the same scan.
- Returns:
Minimum location
- Return type:
float
- pytomography.io.shared.dicom.compute_slice_thickness_multifile(files)[source]#
Compute the slice thickness for files that make up a scan. Though this information is often contained in the DICOM file, it is sometimes inconsistent with the ImagePositionPatient attribute, which gives the true location of the slices.
- Parameters:
files (Sequence[str]) – List of DICOM filepaths corresponding to different z slices of the same scan.
- Returns:
Slice thickness of the scan
- Return type:
float