affinetform3d

3-D affine geometric transformation

Description

An `affinetform3d` object stores information about a 3-D affine geometric transformation and enables forward and inverse transformations.

Creation

You can create an `affinetform3d` object in these ways:

• `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.

• The `affinetform3d` function described here.

Syntax

``tform = affinetform3d``
``tform = affinetform3d(A)``
``tform = affinetform3d(tformIn)``

Description

````tform = affinetform3d` creates an `affinetform3d` object that performs an identity transformation.```

example

````tform = affinetform3d(A)` creates an `affinetform3d` object and sets the property `A` as the specified 3-D affine transformation matrix.```
````tform = affinetform3d(tformIn)` creates an `affinetform3d` object from another geometric transformation object, `tformIn`, that represents a valid 3-D affine geometric transformation.```

Input Arguments

expand all

Affine 3-D geometric transformation, specified as an `affinetform3d` object, `rigidtform3d` object, `simtform3d` object, or `transltform3d` object.

Properties

expand all

Forward 3-D affine transformation, specified as a nonsingular 4-by-4 numeric matrix. The default value of `A` is the identity matrix.

The matrix `A` transforms the point (u, v, w) in the input coordinate space to the point (x, y, z) in the output coordinate space using the convention:

`$\left[\begin{array}{c}x\\ y\\ z\\ 1\end{array}\right]=Α×\left[\begin{array}{c}u\\ v\\ w\\ 1\end{array}\right]$`

For an affine transformation, `A` has the form:

`$Α=\left[\begin{array}{cccc}a& b& c& d\\ e& f& g& h\\ i& j& k& l\\ 0& 0& 0& 1\end{array}\right]$`

Data Types: `double` | `single`

Dimensionality of the geometric transformation for both input and output points, specified as `3`.

Data Types: `double`

Object Functions

 `invert` Invert geometric transformation `outputLimits` Find output spatial limits given input spatial limits `transformPointsForward` Apply forward geometric transformation `transformPointsInverse` Apply inverse geometric transformation

Examples

collapse all

Define a 4-by-4 geometric transformation matrix. This matrix specifies an affine transformation consisting of translation and nonisotropic scaling.

```[sx,sy,sz] = deal(2,2,2.5); [tx,ty,tz] = deal(10,20.5,15); A = [sx 0 0 tx; 0 sy 0 ty; 0 0 sz tz; 0 0 0 1];```

Create an `affinetform3d` object that performs the scaling and translation.

`tform = affinetform3d(A)`
```tform = affinetform3d with properties: Dimensionality: 3 A: [4x4 double] ```

Examine the value of the `A` property.

`tform.A`
```ans = 4×4 2.0000 0 0 10.0000 0 2.0000 0 20.5000 0 0 2.5000 15.0000 0 0 0 1.0000 ```

Version History

Introduced in R2022b

expand all