This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


3-D affine geometric transformation


An affine3d object encapsulates a 3-D affine geometric transformation.


You can create an affine3d object using the following methods:

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

  • The affine3d function described here


tform = affine3d
tform = affine3d(A)


tform = affine3d creates an affine3d object with default property settings that correspond to the identity transformation.


tform = affine3d(A) sets the property T with a valid affine transformation defined by nonsingular matrix A.


expand all

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

The matrix T uses the convention:

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

where T has the form:

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

The default of T is 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

invertInvert geometric transformation
isRigidDetermine if transformation is rigid transformation
isSimilarityDetermine if transformation is similarity transformation
isTranslationDetermine if transformation is pure translation
outputLimitsFind output spatial limits given input spatial limits
transformPointsForwardApply forward geometric transformation
transformPointsInverseApply inverse geometric transformation


collapse all

Create an affine3d object 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.

D = squeeze(D);

Apply the geometric transformation to the image using imwarp.

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 the z-dimension.


The original image is on the left, and the transformed image is on the right. The transformed image is scaled more in the vertical direction than in the horizontal direction, as expected since Sy is larger than Sx.

Introduced in R2013a

Was this topic helpful?