Geometric transform between intrinsic and patient coordinates of medical image volume slice
computes the geometric transformation,
tform = oneSliceIntrinsicToWorldMapping(
tform, between the intrinsic and
patient coordinate systems for one slice of the medical image volume defined by
R. The output
tform maps the geometric
transformation for the specified slice
slice along the third
Get Mapping Between Intrinsic and Patient Coordinate Systems for One Slice
Get the geometric transform between the intrinsic and patient coordinate systems for one slice of a chest CT volume, saved as a directory of DICOM files. 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.
zipFile = matlab.internal.examples.downloadSupportFile("medical","MedicalVolumeDICOMData.zip"); filepath = fileparts(zipFile); unzip(zipFile,filepath)
Specify the directory of the DICOM files for the first CT volume in the data set.
dataFolder = fullfile(filepath,"MedicalVolumeDICOMData","LungCT01");
Create a medical volume object that contains the image and spatial metadata for the CT volume.
medVol = medicalVolume(dataFolder);
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.
R = medVol.VolumeGeometry;
Calculate the transformation that maps between the intrinsic and patient coordinate systems for the 20th slice along the third dimension of the volume. The
oneSliceIntrinsicToWorldMapping function returns an
tform = oneSliceIntrinsicToWorldMapping(R,20)
tform = affinetform3d with properties: Dimensionality: 3 A: [4×4 double]
A property of the
affinetform3d object contains a 4-by-4 geometric transformation matrix.
ans = 4×4 0 0.7285 0 -186.5000 0.7285 0 0 -186.5000 0 0 0.5307 -233.7500 0 0 0 1.0000
R — Spatial referencing information
Spatial referencing information, specified as a
object. The volume specified by
R can be affine or
slice — Slice index
positive integer in range [1, p]
Slice index, specified as a positive integer in the range [1, p], where p is the number of slices in the image volume along the third dimension.
tform — Geometric transformation
Geometric transformation, returned as an
A property of
tform contains a 4-by-4
3-D transformation matrix that maps triplets of pixel indices in the order
(column, row, slice) to
(x, y, z) triplets of patient
coordinates in real-world units.
Introduced in R2022b