LabKit MATLAB Workbench

reference

API ReferenceDIC Preprocess

dic_preprocess.analysisRun.applyRigidTransform

Resample a moving image onto a reference-sized canvas.

Syntax

alignedImage = dic_preprocess.analysisRun.applyRigidTransform( ... referenceImage, movingImage, transform)

Inputs

referenceImage
Image whose height and width define the output canvas. Its pixel values and channel count are not used.
movingImage
Numeric two-dimensional or multichannel source image.
transform
Three-by-three row-vector homogeneous rigid transform. Source points map forward as [x y 1]*transform. The upper-left two-by-two block is rotation and row 3, columns 1:2 are [x y] translation.

Outputs

alignedImage
Linearly interpolated moving image on the reference height and width, preserving movingImage class and channels. Samples outside movingImage are 0; integer outputs are rounded and clipped to range.

Description

The function performs inverse mapping for every output pixel using base MATLAB interp2. It assumes the supplied two-by-two block is an orthogonal rotation; scale or shear matrices are not validated.

Failure Behavior

transform is expected to be a finite 3-by-3 numeric matrix and images must be compatible with interp2 and output casting. The function does not validate finiteness, rigidity, or invertibility; nonfinite or nonrigid values can therefore produce an unusable image without a dedicated error. Invalid dimensions and unsupported classes propagate the originating indexing, interpolation, or cast error.

Example

moving = uint8(reshape(1:25, 5, 5));
transform = [1 0 0; 0 1 0; 1 0 1];
aligned = dic_preprocess.analysisRun.applyRigidTransform( ...
zeros(5), moving, transform);
assert(isa(aligned, "uint8") && aligned(1,1) == 0)
assert(aligned(1,2) == moving(1,1))

Source

This page is generated from the MATLAB help text in apps/dic/dic_preprocess/+dic_preprocess/+analysisRun/applyRigidTransform.m.