This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Configurations for intensity-based registration


[optimizer,metric] = imregconfig(modality)



[optimizer,metric] = imregconfig(modality) creates optimizer and metric configurations that you pass to imregister to perform intensity-based image registration. imregconfig returns optimizer and metric with default settings to provide a basic registration configuration.


collapse all

Read two images. This example uses two magnetic resonance (MRI) images of a knee. The fixed image is a spin echo image, while the moving image is a spin echo image with inversion recovery. The two sagittal slices were acquired at the same time but are slightly out of alignment.

fixed = dicomread('knee1.dcm');
moving = dicomread('knee2.dcm');

View the misaligned images.

imshowpair(fixed, moving,'Scaling','joint')

Create the optimizer and metric, setting the modality to 'multimodal' since the images come from different sensors.

[optimizer, metric] = imregconfig('multimodal')
optimizer = 

         GrowthFactor: 1.050000e+00
              Epsilon: 1.500000e-06
        InitialRadius: 6.250000e-03
    MaximumIterations: 100
metric = 

    NumberOfSpatialSamples: 500
     NumberOfHistogramBins: 50
              UseAllPixels: 1

Tune the properties of the optimizer to get the problem to converge on a global maxima and to allow for more iterations.

optimizer.InitialRadius = 0.009;
optimizer.Epsilon = 1.5e-4;
optimizer.GrowthFactor = 1.01;
optimizer.MaximumIterations = 300;

Perform the registration.

movingRegistered = imregister(moving, fixed, 'affine', optimizer, metric);

View the registered images.

imshowpair(fixed, movingRegistered,'Scaling','joint')

Input Arguments

collapse all

Image capture modality describes how your images have been captured, specified as either 'monomodal' (with similar brightness and contrast) or 'multimodal' (with different brightness or contrast).

Output Arguments

collapse all

Optimization configuration, returned as a RegularStepGradientDescent or OnePlusOneEvolutionary optimizer object.

Metric configuration describes the image similarity metric to be optimized during registration, returned as a MeanSquares or MattesMutualInformation metric object.

More About

collapse all


Monomodal images have similar brightness and contrast. The images are captured on the same type of scanner or sensor.


Multimodal images have different brightness and contrast. The images can come from two different types of devices, such as two camera models or two types of medical imaging modalities (like CT and MRI). The images can also come from a single device, such as a camera using different exposure settings, or an MRI scanner using different imaging sequences.


  • If you adjust the optimizer or metric parameters, the registration results can improve. For example, if you increase the number of iterations in the optimizer, reduce the optimizer step size, or change the number of samples in a stochastic metric, the registration improves to a point, at the expense of performance.

Introduced in R2012a

Was this topic helpful?