imref3d class

Reference 3-D image to world coordinates

Description

An imref3d object encapsulates the relationship between the intrinsic coordinates anchored to the columns, rows, and planes of a 3-D image and the spatial location of the same column, row, and plane locations in a world coordinate system. The image is sampled regularly in the planar world- X, world-Y, and world-Z coordinates of the coordinate system such that intrinsic-X values align with world-X values, intrinsic-Y values align with world-Y values, and intrinsic-Z values align with world-Z values. The pixel spacing in each dimension may be different.

The intrinsic coordinate values (x,y,z) of the center point of any pixel are identical to the values of the column, row, and plane subscripts for that pixel. For example, the center point of the pixel in row 5, column 3, plane 4 has intrinsic coordinates x = 3.0, y = 5.0, z = 4.0. Be aware, however, that the order of the coordinate specification (3.0,5.0,4.0) is reversed in intrinsic coordinates relative to pixel subscripts (5,3,4). Intrinsic coordinates are defined on a continuous plane while the subscript locations are discrete locations with integer values.

Construction

R = imref3d() creates an imref3d object with default property settings.

R = imref3d(imageSize) creates an imref3d object given an image size. This syntax constructs a spatial referencing object for the default case in which the world coordinate system is co-aligned with the intrinsic coordinate system.

R = imref3d(imageSize,pixelExtentInWorldX,pixelExtentInWorldY,pixelExtentInWorldZ) creates an imref3d object given an image size and the resolution in each dimension, specified by pixelExtentInWorldX, pixelExtentInWorldY, and pixelExtentInWorldZ.

R = imref3d(imageSize,xWorldLimits,yWorldLimits,zWorldLimits) creates an imref3d object given an image size and the world limits in each dimension, specified by xWorldLimits, yWorldLimits and zWorldLimits.

Code Generation: imref3d supports the generation of efficient, production-quality C/C++ code from MATLAB. When generating code, you can only specify singular objects—arrays of objects are not supported. To see a complete list of all the list of toolbox functions that support code generation, see List of Supported Functions with Usage Notes.

Input Arguments

imageSize

Size of the image associated with the object, specified as a three-element row vector of class double, such as [128 128 27], as returned by the size function.

PixelExtentInWorldX

Size of a single pixel in X dimension measured in the world coordinate system, specified as a double.

PixelExtentInWorldY

Size of a single pixel in Y dimension measured in the world coordinate system, specified as a double.

PixelExtentInWorldZ

Size of a single pixel in Z dimension measured in the world coordinate system, specified as a double.

xWorldLimits

Minimum and maximum coordinate values in X dimension in world coordinate system, specified as a two-element numeric vector of class double, such as [0.5 256.5].

yWorldLimits

Minimum and maximum coordinate values in Y in world coordinate system, specified as a two-element numeric vector of class double, such as [0.5 256.5].

zWorldLimits

Minimum and maximum coordinate values in Z in world coordinate system, specified as a two-element numeric vector of class double, such as [0.5 256.5].

Properties

ImageExtentInWorldX

Span of image in X dimension in the world coordinate system, specified as a numeric scalar. The imref3d object calculates this value as PixelExtentInX * ImageSize(2).

ImageExtentInWorldY

Span of image in Y dimension in the world coordinate system, specified as a numeric scalar. The imref3d object calculates this value as PixelExtentInY * ImageSize(1).

ImageExtentInWorldZ

Span of image in Z dimension in the world coordinate system, specified as a numeric scalar. The imref3d object calculates this value as PixelExtentInZ * ImageSize(3).

ImageSize

Number of elements in each spatial dimension, specified as a three-element vector, in the same form as that returned by the size function.

PixelExtentInWorldX

Size of a single pixel in X dimension measured in the world coordinate system, specified as a double.

PixelExtentInWorldY

Size of a single pixel in Y dimension measured in the world coordinate system, specified as a double.

PixelExtentInWorldZ

Size of a single pixel in Z dimension measured in the world coordinate system, specified as a double.

XWorldLimits

Limits of image in world X, specified as a two-element row vector, [xMin xMax].

YWorldLimits

Limits of image in world Y, specified as a two-element row vector, [yMin yMax].

ZWorldLimits

Limits of image in world Z, specified as a two-element row vector, [zMin zMax].

XIntrinsicLimits

Limits of image in intrinsic units in X dimension, specified as a two-element row vector [xMin xMax]. For an M-by-N-by-P image, it equals [0.5, N + 0.5].

YIntrinsicLimits

Limits of image in intrinsic units in Y dimension, specified as a two-element row vector [yMin yMax]. For an M-by-N-by-P image, it equals [0.5, M + 0.5].

ZIntrinsicLimits

Limits of image in intrinsic units in Z dimension, specified as a two-element row vector [zMin zMax]. For an M-by-N-by-P image, it equals [0.5, P + 0.5].

Methods

contains True if image contains points in world coordinate system
intrinsicToWorld Convert from intrinsic to world coordinates
sizesMatchTrue if object and image are size-compatible
worldToIntrinsicConvert from world to intrinsic coordinates
worldToSubscript World coordinates to row and column subscripts

Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects in the MATLAB® documentation.

Examples

expand all

Create imref3d Object Given Knowledge of Image Size and Resolution in each Dimension

Read image.

m = analyze75info('brainMRI.hdr');
A = analyze75read(m);

Create an imref3d object associated with the image, specifying the size of the pixels. The PixelDimensions field of the metadata of the file specifies the resolution in each dimension in millimeters/pixel.

RA = imref3d(size(A),m.PixelDimensions(2),m.PixelDimensions(1),m.PixelDimensions(3));
RA = 

  imref3d with properties:

           XWorldLimits: [0.5000 128.5000]
           YWorldLimits: [0.5000 128.5000]
           ZWorldLimits: [0.5000 27.5000]
              ImageSize: [128 128 27]
    PixelExtentInWorldX: 1
    PixelExtentInWorldY: 1
    PixelExtentInWorldZ: 1
    ImageExtentInWorldX: 128
    ImageExtentInWorldY: 128
    ImageExtentInWorldZ: 27
       XIntrinsicLimits: [0.5000 128.5000]
       YIntrinsicLimits: [0.5000 128.5000]
       ZIntrinsicLimits: [0.5000 27.5000]

Examine the extent of the image in each dimension in millimeters.

RA.ImageExtentInWorldX
RA.ImageExtentInWorldY
RA.ImageExtentInWorldZ
ans =

   128

ans =

   128

ans =

    27

See Also

Was this topic helpful?