dicomtools.volume module¶
-
class
dicomtools.volume.
DicomVolume
(dicom_series)¶ Bases:
object
Simplifies working with 3D DICOM data.
-
build_image_to_patient_matrix
()¶ Get a matrix to transform a pixel coordinate to a DICOM patient coordinate. The pixel coordinate corresponds to the center of that pixel/voxel.
The DICOM standard defines the patient coordinate system as:
- x -> increasing to the left hand side of the patient
- y -> increasing to the posterior side of the patient
- z -> increasing toward the head of the patient
source: https://public.kitware.com/IGSTKWIKI/index.php/DICOM_data_orientation
-
export_images
(directory, filename_prefix, axis=2)¶ Save slices of the volume to images. The pixels in the resulting images will be square, regardless of the DICOM pixel size. These images should not be expected to have perfect pixel-accuracy, and compression may be used.
-
get_dimensions_in_mm
()¶ Get the dimensions in millimeters for each axis of the volume. Returns a list of length 3.
For 3 pixels...
+---+ +---+ +---+ | 1 | | 2 | | 3 | +---+ +---+ +---+ |-|-------|-------|-| ^ ^ ^ ^ | | | | | | | ---- 1/2 pixel_size | | --------- 1 pixel_spacing | ----------------- 1 pixel_spacing ---------------------- 1/2 pixel_size
-
-
dicomtools.volume.
compare_volume_metadata
(volume1, volume2)¶ This compares the volume metadata (position, pixel_size, etc) and shape of the pixel data, but not the actual pixel data. Returns True if equal, otherwise returns False.