Main Content

oneSliceIntrinsicToWorldMapping

Geometric transform between intrinsic and patient coordinates of medical image volume slice

    Description

    example

    tform = oneSliceIntrinsicToWorldMapping(R,slice) computes the geometric transformation, 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 dimension.

    Examples

    collapse all

    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);

    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.

    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 affinetform3d object, tform.

    tform = oneSliceIntrinsicToWorldMapping(R,20)
    tform = 
      affinetform3d with properties:
    
        Dimensionality: 3
                     A: [4×4 double]
    
    

    The A property of the affinetform3d object contains a 4-by-4 geometric transformation matrix.

    tform.A
    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
    
    

    Input Arguments

    collapse all

    Spatial referencing information, specified as a medicalref3d object. The volume specified by R can be affine or non-affine.

    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.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Output Arguments

    collapse all

    Geometric transformation, returned as an affinetform3d object.

    The 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.

    Version History

    Introduced in R2022b