Main Content

intrinsicToWorld

Map points from intrinsic coordinates to patient coordinates

    Description

    example

    [X,Y,Z] = intrinsicToWorld(R,I,J,K) maps points from the intrinsic coordinate system to the patient coordinate system using the spatial referencing information, R. The intrinsic coordinates I, J, and K are defined by axes aligned with the row, column, and slice subscripts of the image data array, respectively. The patient coordinates X, Y, and Z are defined by the patient coordinate system axes.

    Examples

    collapse all

    Map 3-D intrinsic coordinates from a chest CT volume, saved as a directory of DICOM files, to patient coordinates. 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;

    Select three sample points, and store their (i, j, k) intrinsic coordinates, in voxels. The points must fall within the image boundary.

    I = [54 200 512];
    J = [46 48 79];
    K = [1 13 88];

    Convert the intrinsic coordinates to patient coordinates. The output vectors provide the (x, y, z) patient coordinates, in millimeters.

    [X,Y,Z] = intrinsicToWorld(R,I,J,K)
    X = 1×3
    
     -147.8887  -41.5253  185.7717
    
    
    Y = 1×3
    
     -153.7168 -152.2597 -129.6758
    
    
    Z = 1×3
    
     -281.2500 -251.2500  -63.7500
    
    

    Input Arguments

    collapse all

    Spatial referencing information, specified as a medicalref3d object.

    Coordinates along the i-dimension in the intrinsic coordinate system, specified as a numeric array. The i-axis is aligned with the first dimension of the spatial volume specified by R.

    I, J, and K must be the same size.

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

    Coordinates along the j-dimension in the intrinsic coordinate system, specified as a numeric array. The j-axis is aligned with the second dimension of the spatial volume specified by R.

    I, J, and K must be the same size.

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

    Coordinates along the k-dimension in the intrinsic coordinate system, specified as a numeric array. The k-axis is aligned with the third dimension of the spatial volume specified by R.

    I, J, and K must be the same size.

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

    Output Arguments

    collapse all

    Coordinates along the x-dimension in the patient coordinate system, returned as a numeric array. X is the same size as I.

    Data Types: double

    Coordinates along the y-dimension in the patient coordinate system, returned as a numeric array. Y is the same size as I.

    Data Types: double

    Coordinates along the z-dimension in the patient coordinate system, returned as a numeric array. Z is the same size as I.

    Data Types: double

    Version History

    Introduced in R2022b