You are here : matlabImage Processingimregtform

imregtform() - Image Processing

tform = imregtform(moving,fixed,transformType,optimizer,metric) estimates
the geometric transformation that aligns the moving image moving with
the fixed image fixed. transformType is
a string that defines the type of transformation to estimate. optimizer is
an object that describes the method for optimizing the metric. metric is
an object that defines the quantitative measure of similarity between
the images to optimize. The output tform is a
geometric transformation object that maps moving to fixed.tform = imregtform(moving,Rmoving,fixed,Rfixed,transformType,optimizer,metric) estimates
the geometric transformation where Rmoving and Rfixed specify
the spatial referencing objects associated with the moving and fixed images.
The output tform is a geometric transformation
object in units defined by the spatial referencing objects Rmoving and Rfixed.tform = imregtform(___,Name,Value) estimates
the geometric transformation using name-value pairs to control aspects
of the operation.


Syntax

tform = imregtform(moving,fixed,transformType,optimizer,metric) exampletform = imregtform(moving,Rmoving,fixed,Rfixed,transformType,optimizer,metric)tform = imregtform(___,Name,Value)


Example

Estimate Transformation Needed to Register Two Misaligned ImagesRead two slightly misaligned magnetic resonance images
of a knee obtained using different protocols and view the images overlaid
on each other.fixed  = dicomread('knee1.dcm');
moving = dicomread('knee2.dcm');

imshowpair(fixed, moving,'Scaling','joint');
Get default optimizer and metric configurations suitable
for registering images from different sensors (‘multimodal').
Then tune the properties of the optimizer to get the problem to converge
on a global maxima and to allow for more iterations.[optimizer, metric] = imregconfig('multimodal')

optimizer.InitialRadius = 0.009;
optimizer.Epsilon = 1.5e-4;
optimizer.GrowthFactor = 1.01;
optimizer.MaximumIterations = 300;Find the geometric transformation that maps the image
to be registered (moving) to the reference image
(fixed).tform = imregtform(moving, fixed, 'affine', optimizer, metric)tform = 

  affine2d with properties:

                 T: [3x3 double]
    Dimensionality: 2Apply the transformation to the image being registered
(moving) using the imwarp function.
The example uses the 'OutputView' parameter to
preserve world limits and resolution of the fixed image when forming
the transformed image.movingRegistered = imwarp(moving,tform,'OutputView',imref2d(size(fixed)));View registered imagesfigure
imshowpair(fixed, movingRegistered,'Scaling','joint');


Output / Return Value


Limitations


Alternatives / See Also


Reference