Main Content

RegularStepGradientDescent

Regular step gradient descent optimizer configuration

Description

ARegularStepGradientDescentobject describes a regular step gradient descent optimization configuration that you pass to the functionimregisterto solve image registration problems.

Creation

You can create aRegularStepGradientDescentobject using the following methods:

  • imregconfig——返回一个RegularStepGradientDescentobject paired with an appropriate metric for registering monomodal images

  • Entering

    metric = registration.optimizer.RegularStepGradientDescent;
    on the command line creates aRegularStepGradientDescentobject with default settings

Properties

expand all

Gradient magnitude tolerance, specified as a positive scalar.GradientMagnitudeTolerancecontrols the optimization process. When the value of the gradient is smaller thanGradientMagnitudeTolerance, it is an indication that the optimizer might have reached a plateau.

Data Types:double|single|uint8|uint16|uint32|uint64|int8|int16|int32|int64

Tolerance for convergence, specified as a positive scalar.MinimumStepLengthcontrols the accuracy of convergence. If you setMinimumStepLengthto a small value, the optimization takes longer to compute, but it is likely to converge on a more accurate metric value.

Data Types:double|single|uint8|uint16|uint32|uint64|int8|int16|int32|int64

Initial step length, specified as a positive scalar. The initial step length is the maximum step length because the optimizer reduces the step size during convergence. If you setMaximumStepLengthto a large value, the computation time decreases. However, the optimizer might fail to converge if you setMaximumStepLengthto an overly large value.

Data Types:double|single|uint8|uint16|uint32|uint64|int8|int16|int32|int64

Maximum number of iterations, specified as a positive integer scalar.MaximumIterationsis a positive scalar integer value that determines the maximum number of iterations the optimizer performs at any given pyramid level. The registration could converge before the optimizer reaches the maximum number of iterations.

Data Types:double|single|uint8|uint16|uint32|uint64|int8|int16|int32|int64

Step length reduction factor, specified as a positive scalar between 0 and 1.RelaxationFactordefines the rate at which the optimizer reduces step size during convergence. Whenever the optimizer determines that the direction of the gradient changed, it reduces the size of the step length. If your metric is noisy, you can setRelaxationFactorto a larger value. This leads to a more stable convergence at the expense of computation time.

Data Types:double|single|uint8|uint16|uint32|uint64|int8|int16|int32|int64

Examples

collapse all

创建一个RegularStepGradientDescentobject and use it to register two images with similar brightness and contrast.

Read the reference image and create an unregistered copy.

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

View the misaligned images.

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

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

Create the optimizer configuration object suitable for registering monomodal images.

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

Create the metric configuration object.

metric = registration.metric.MeanSquares;

Modify the optimizer configuration to get more precision.

optimizer.MaximumIterations = 300; optimizer.MinimumStepLength = 5e-4;

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 axes object contains an object of type image.

Algorithms

The regular step gradient descent optimization adjusts the transformation parameters so that the optimization follows the gradient of the image similarity metric in the direction of the extrema. It uses constant length steps along the gradient between computations until the gradient changes direction. At this point, the step length is reduced based on theRelaxationFactor, which halves the step length by default.

Extended Capabilities

版本历史

Introduced in R2012a