Main Content

affine3d

3-D affine geometric transformation

Description

Anaffine3dobject stores information about a 3-D affine geometric transformation and enables forward and inverse transformations.

Creation

You can create anaffine3dobject using the following methods:

  • imregtform— Estimates a geometric transformation that maps a moving image to a fixed image using similarity optimization

  • randomAffine3d— Creates a randomized 3-D affine transformation

  • Theaffine3dfunction described here

Description

tform = affine3dcreates anaffine3dobject with default property settings that correspond to the identity transformation.

example

tform = affine3d(A)sets the propertyTwith a valid affine transformation defined by nonsingular matrixA.

Properties

expand all

Forward 3-D affine transformation, specified as a nonsingular 4-by-4 numeric matrix.

The matrixTuses the convention:

[x y z 1] = [u v w 1] * T

whereThas the form:

[a b c 0; d e f 0; g h i 0; j k l 1];

The default ofTis the identity transformation.

Data Types:double|single

Describes the dimensionality of the geometric transformation for both input and output points, specified as the value 3.

Object Functions

invert Invert geometric transformation
isRigid Determine if transformation is rigid transformation
isSimilarity Determine if transformation is similarity transformation
isTranslation Determine if transformation is pure translation
outputLimits Find output spatial limits given input spatial limits
transformPointsForward Apply forward geometric transformation
transformPointsInverse Apply inverse geometric transformation

Examples

collapse all

Create anaffine3dobject that scales a 3-D image by a different factor in each dimension.

Sx = 1.2; Sy = 1.6; Sz = 2.4; tform = affine3d([Sx 0 0 0; 0 Sy 0 0; 0 0 Sz 0; 0 0 0 1])
tform = affine3d with properties: T: [4x4 double] Dimensionality: 3

Load a 3-D volume into the workspace.

load('mri'); D = squeeze(D);

Apply the geometric transformation to the image usingimwarp.

B = imwarp(D,tform);

Visualize an axial slice through the center of each volume to see the effect of scale translation. Note that the center slice of the transformed volume has a different index than the center slice of the original volume because of the scaling in thez-dimension.

figure imshowpair(D(:,:,14),B(:,:,33),'montage');

Figure contains an axes object. The axes object contains an object of type image.

原始图像在左边,transformed image is on the right. The transformed image is scaled more in the vertical direction than in the horizontal direction, as expected sinceSyis larger thanSx.

Extended Capabilities

Version History

Introduced in R2013a