Map 3-D patient coordinates from a chest CT volume, saved as a directory of DICOM files, to image subscripts. The volume is part of a data set containing three CT volumes. The size of the entire data set is approximately 81 MB. Download the data set from the MathWorks® website, then unzip the folder.
Specify the directory of the DICOM files for the first CT volume in the data set.
Create a medical volume object that contains the image and spatial metadata for the CT volume.
The VolumeGeometry
property of the medical volume object contains a medicalref3d
object that specifies the spatial referencing for the volume. Extract the medicalref3d
object for the chest CT.
Select three sample points, and store their (x,y,z) patient coordinates, in millimeters. For example, the first point has patient coordinates of (100, 101, –200), in mm. The third point is outside the image boundary.
Convert the world coordinates to row, column, and slice indices. The worldToSubscript
function rounds the transformed world coordinates to integer values. The function extrapolates the subscripts of the point outside the image boundary.
If you receive a warning that an approximate mapping is being used, then the image volume is nearly but not perfectly affine. This might be due to small numeric precision errors in how the data was encoded in the file, or due to the discrete step sizes of motors used to move the patient through the scanner. If an approximate mapping is used, you might expect small errors, on the order of millimeters in patient coordinates.
Warning: An approximate world to intrinsic mapping is being used.