Main Content

imregconfig

Configurations for intensity-based registration

Description

[optimizer,metric] = imregconfig(modality) creates optimizer and metric configurations that you pass to imregister to perform intensity-based image registration, where modality specifies the image capture modality.

example

Examples

collapse all

Load the images into the workspace and display them. These images are monomodal because they have similar brightness and contrast.

fixed  = imread('pout.tif');
moving = imrotate(fixed, 5, 'bilinear', 'crop');
imshowpair(fixed, moving,'Scaling','joint')

Figure contains an axes object. The hidden axes object contains an object of type image.

Create the optimizer and metric, setting the modality to 'monomodal'.

[optimizer, metric]  = imregconfig('monomodal')
optimizer = 
  registration.optimizer.RegularStepGradientDescent

  Properties:
    GradientMagnitudeTolerance: 1.000000e-04
             MinimumStepLength: 1.000000e-05
             MaximumStepLength: 6.250000e-02
             MaximumIterations: 100
              RelaxationFactor: 5.000000e-01
metric = 
  registration.metric.MeanSquares

  This class has no properties.

Pass the optimizer and metric to imregister to perform the registration.

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

View the registered images

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

Figure contains an axes object. The hidden axes object contains an object of type image.

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")

Figure contains an axes object. The hidden axes object contains an object of type image.

Create the optimizer and metric, specifying the modality as "multimodal" because the images come from different sensors.

[optimizer,metric] = imregconfig("multimodal")
optimizer = 
  registration.optimizer.OnePlusOneEvolutionary

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

  Properties:
    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")

Figure contains an axes object. The hidden axes object contains an object of type image.

Input Arguments

collapse all

Image capture modality, specified as one of these values.

ModalityDescription
"monomodal"

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

"multimodal"

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.

Data Types: char | string

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.

Tips

  • imregconfig returns optimizer and metric with default settings to provide a basic registration configuration. If you adjust the optimizer or metric properties, then 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.

Extended Capabilities

Version History

Introduced in R2012a

expand all