# outputLimits

Find output spatial limits given input spatial limits

## Description

example

[xLimitsOut,yLimitsOut] = outputLimits(tform,xLimitsIn,yLimitsIn) estimates the output spatial limits corresponding to a set of input spatial limits, xLimitsIn and yLimitsIn, given 2-D geometric transformation tform.

example

[xLimitsOut,yLimitsOut,zLimitsOut] = outputLimits(tform,xLimitsIn,yLimitsIn,zLimitsIn) estimates the output spatial limits, given 3-D geometric transformation tform.

## Examples

collapse all

Define a 3-by-3 geometric transformation matrix. This example specifies a matrix for an affine transformation consisting of vertical shear and horizontal stretch.

A = [2 0 0; 0.33 1 0; 0 0 1];

Create an affinetform2d object from the transformation matrix.

tform = affinetform2d(A);

Read an image and calculate the size of the image.

[height,width,~] = size(I)
height = 291
width = 240

Estimate the output spatial limits.

[xlim,ylim] = outputLimits(tform,[1 width],[1 height])
xlim = 1×2

2   480

ylim = 1×2

1.3300  370.2000

Define a rigid geometric transformation consisting only of translation.

t = [10 20.5 15];
tform = transltform3d(t);

Estimate the output spatial limits for a volume of size 128-by-128-by-128 voxels.

[xlim,ylim,zlim] = outputLimits(tform,[1 128],[1 128],[1 128])
xlim = 1×2

11   138

ylim = 1×2

21.5000  148.5000

zlim = 1×2

16   143

## Input Arguments

collapse all

Geometric transformation, specified as a geometric transformation object listed in the table.

Geometric Transformation ObjectDescription
2-D Linear Geometric Transformations
transltform2dTranslation transformation
rigidtform2dRigid transformation: translation and rotation
simtform2dSimilarity transformation: translation, rotation, and isotropic scaling
affinetform2dAffine transformation: translation, rotation, anisotropic scaling, reflection, and shearing
projtform2dProjective transformation
3-D Linear Geometric Transformations
transltform3dTranslation transformation
rigidtform3dRigid transformation: translation and rotation
simtform3dSimilarity transformation: translation, rotation, and isotropic scaling
affinetform3dAffine transformation: translation, rotation, anisotropic scaling, reflection, and shearing
Nonlinear Geometric Transformations
geometricTransform2dCustom 2-D geometric transformation using point-wise mapping functions
geometricTransform3dCustom 3-D geometric transformation using point-wise mapping functions
LocalWeightedMeanTransformation2D2-D local weighted means transformation
PiecewiseLinearTransformation2D2-D piecewise linear transformation
PolynomialTransformation2D2-D polynomial transformation

Note

You can also specify tform as an object of type rigid2d, rigid3d, affine2d, affine3d, or projective2d. However, these objects are not recommended. For more information, see Compatibility Considerations.

Input spatial limits in the x-dimension, specified as a 1-by-2 numeric vector.

Data Types: double

Input spatial limits in the y-dimension, specified as a 1-by-2 numeric vector.

Data Types: double

Input spatial limits in the z-dimension, specified as a 1-by-2 numeric vector. Specify zLimitsIn only when tform is an object representing a 3-D geometric transformation.

Data Types: double

## Output Arguments

collapse all

Output spatial limits in the x-dimension, returned as a 1-by-2 numeric vector.

Data Types: double

Output spatial limits in the y-dimension, returned as a 1-by-2 numeric vector.

Data Types: double

Output spatial limits in the z-dimension, returned as a 1-by-2 numeric vector. outputLimits returns zLimitsIn only when tform is an object representing a 3-D geometric transformation.

Data Types: double

## Version History

Introduced in R2013a

expand all