#include <elxAdaptiveStochasticLBFGS.h>
A gradient descent optimizer with an adaptive gain.
This class is a wrap around the AdaptiveStochasticVarianceReducedGradientOptimizer class. It takes care of setting parameters and printing progress information. For more information about the optimization method, please read the documentation of the AdaptiveStochasticVarianceReducedGradientOptimizer class.
This optimizer is very suitable to be used in combination with the Random image sampler, or with the RandomCoordinate image sampler, with the setting (NewSamplesEveryIteration "true"). Much effort has been spent on providing reasonable default values for all parameters, to simplify usage. In most registration problems, good results should be obtained without specifying any of the parameters described below (except the first of course, which defines the optimizer to use).
This optimization method is described in the following references:
[1] Y.Qiao, Z.Sun, B.P.F. Lelieveldt, M.Staring A stochastic quasi-newton method for non-rigid image registration Medical Image Computing and Computer-Assisted Intervention (MICCAI), pp. 297-304, 2015. http://dx.doi.org/10.1007/978-3-319-24571-3_36
The parameters used in this class are:
Optimizer: Select this optimizer as follows:
(Optimizer "AdaptiveStochasticLBFGS")
MaximumNumberOfIterations: The maximum number of iterations in each resolution.
example: (MaximumNumberOfIterations 100 100 50)
Default/recommended value: 500. When you are in a hurry, you may go down to 250 for example. When you have plenty of time, and want to be absolutely sure of the best results, a setting of 2000 is reasonable. In general, 500 gives satisfactory results.
MaximumNumberOfSamplingAttempts: The maximum number of sampling attempts. Sometimes not enough corresponding samples can be drawn, upon which an exception is thrown. With this parameter it is possible to try to draw another set of samples.
example: (MaximumNumberOfSamplingAttempts 10 15 10)
Default value: 0, i.e. just fail immediately, for backward compatibility.
AutomaticParameterEstimation: When this parameter is set to "true", many other parameters are calculated automatically: SP_a, SP_alpha, SigmoidMax, SigmoidMin, and SigmoidScale. In the elastix.log file the actually chosen values for these parameters can be found.
example: (AutomaticParameterEstimation "true")
Default/recommended value: "true". The parameter can be specified for each resolution, or for all resolutions at once.
UseAdaptiveStepSizes: When this parameter is set to "true", the adaptive step size mechanism described in the documentation of itk::AdaptiveStochasticVarianceReducedGradientOptimizer is used. The parameter can be specified for each resolution, or for all resolutions at once.
example: (UseAdaptiveStepSizes "true")
Default/recommend value: "true", because it makes the registration more robust. In case of using a RandomCoordinate sampler, with (UseRandomSampleRegion "true"), the adaptive step size mechanism is turned off, no matter the user setting.
MaximumStepLength: Also called . This parameter can be considered as the maximum voxel displacement between two iterations. The larger this parameter, the more aggressive the optimization. The parameter can be specified for each resolution, or for all resolutions at once.
example: (MaximumStepLength 1.0)
Default: mean voxel spacing of fixed and moving image. This seems to work well in general. This parameter only has influence when AutomaticParameterEstimation is used.
Definition at line 103 of file elxAdaptiveStochasticLBFGS.h.
Data Structures | |
struct | MultiThreaderParameterType |
Static Public Member Functions | |
static Pointer | New () |
Static Public Member Functions inherited from itk::AdaptiveStochasticLBFGSOptimizer | |
static Pointer | New () |
Static Public Member Functions inherited from itk::StandardStochasticGradientOptimizer | |
static Pointer | New () |
Static Public Member Functions inherited from itk::StochasticGradientDescentOptimizer | |
static Pointer | New () |
Static Public Member Functions inherited from itk::ScaledSingleValuedNonLinearOptimizer | |
static Pointer | New () |
Static Public Member Functions inherited from elastix::BaseComponent | |
template<typename TBaseComponent > | |
static auto | AsITKBaseType (TBaseComponent *const baseComponent) -> decltype(baseComponent->GetAsITKBaseType()) |
static void | InitializeElastixExecutable () |
static bool | IsElastixLibrary () |
Protected Member Functions | |
AdaptiveStochasticLBFGS () | |
virtual void | AddRandomPerturbation (ParametersType ¶meters, double sigma) |
virtual void | AutomaticLBFGSStepsizeEstimation () |
virtual void | AutomaticParameterEstimation () |
virtual void | AutomaticParameterEstimationOriginal () |
virtual void | AutomaticParameterEstimationUsingDisplacementDistribution () |
virtual void | ComputeDiagonalMatrix (DiagonalMatrixType &diag_H0) |
virtual void | ComputeSearchDirection (const DerivativeType &gradient, DerivativeType &searchDir) |
virtual void | GetScaledDerivativeWithExceptionHandling (const ParametersType ¶meters, DerivativeType &derivative) |
itkStaticConstMacro (FixedImageDimension, unsigned int, FixedImageType::ImageDimension) | |
itkStaticConstMacro (MovingImageDimension, unsigned int, MovingImageType::ImageDimension) | |
virtual void | SampleGradients (const ParametersType &mu0, double perturbationSigma, double &gg, double &ee) |
virtual void | StoreCurrentPoint (const ParametersType &step, const DerivativeType &grad_dif) |
~AdaptiveStochasticLBFGS () override=default | |
Protected Member Functions inherited from itk::AdaptiveStochasticLBFGSOptimizer | |
AdaptiveStochasticLBFGSOptimizer () | |
void | UpdateCurrentTime () override |
~AdaptiveStochasticLBFGSOptimizer () override=default | |
Protected Member Functions inherited from itk::StandardStochasticGradientOptimizer | |
virtual double | Compute_a (double k) const |
virtual double | Compute_beta (double k) const |
StandardStochasticGradientOptimizer () | |
~StandardStochasticGradientOptimizer () override=default | |
Protected Member Functions inherited from itk::StochasticGradientDescentOptimizer | |
void | PrintSelf (std::ostream &os, Indent indent) const override |
StochasticGradientDescentOptimizer () | |
~StochasticGradientDescentOptimizer () override=default | |
Protected Member Functions inherited from itk::ScaledSingleValuedNonLinearOptimizer | |
virtual void | GetScaledDerivative (const ParametersType ¶meters, DerivativeType &derivative) const |
virtual MeasureType | GetScaledValue (const ParametersType ¶meters) const |
virtual void | GetScaledValueAndDerivative (const ParametersType ¶meters, MeasureType &value, DerivativeType &derivative) const |
void | PrintSelf (std::ostream &os, Indent indent) const override |
ScaledSingleValuedNonLinearOptimizer () | |
void | SetCurrentPosition (const ParametersType ¶m) override |
virtual void | SetScaledCurrentPosition (const ParametersType ¶meters) |
~ScaledSingleValuedNonLinearOptimizer () override=default | |
Protected Member Functions inherited from elastix::OptimizerBase< TElastix > | |
virtual bool | GetNewSamplesEveryIteration () const |
OptimizerBase ()=default | |
virtual void | SelectNewSamples () |
~OptimizerBase () override=default | |
Protected Member Functions inherited from elastix::BaseComponentSE< TElastix > | |
BaseComponentSE ()=default | |
~BaseComponentSE () override=default | |
Protected Member Functions inherited from elastix::BaseComponent | |
BaseComponent ()=default | |
virtual | ~BaseComponent ()=default |
Private Member Functions | |
void | ThreadedAdvanceOneStep (ThreadIdType threadId, ParametersType &newPosition) |
Static Private Member Functions | |
static itk::ITK_THREAD_RETURN_TYPE | AdvanceOneStepThreaderCallback (void *arg) |
Additional Inherited Members | |
Static Protected Member Functions inherited from elastix::OptimizerBase< TElastix > | |
static void | PrintSettingsVector (const SettingsVectorType &settings) |
|
protected |
Definition at line 279 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 248 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 244 of file elxAdaptiveStochasticLBFGS.h.
using elastix::AdaptiveStochasticLBFGS< TElastix >::ConstPointer = itk::SmartPointer<const Self> |
Definition at line 115 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 278 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 287 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 239 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 240 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 238 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Protected typedefs
Definition at line 235 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 267 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Image grid sampler.
Definition at line 266 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 263 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 262 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 256 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 255 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 254 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 253 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 261 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Image random sampler.
Definition at line 260 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 269 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 268 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 252 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Samplers:
Definition at line 251 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 257 of file elxAdaptiveStochasticLBFGS.h.
using elastix::AdaptiveStochasticLBFGS< TElastix >::ITKBaseType = typename Superclass2::ITKBaseType |
Definition at line 137 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 241 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 243 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 245 of file elxAdaptiveStochasticLBFGS.h.
using elastix::AdaptiveStochasticLBFGS< TElastix >::LineOptimizerPointer = LineOptimizerType::Pointer |
Definition at line 151 of file elxAdaptiveStochasticLBFGS.h.
using elastix::AdaptiveStochasticLBFGS< TElastix >::LineOptimizerType = itk::MoreThuenteLineSearchOptimizer |
Definition at line 150 of file elxAdaptiveStochasticLBFGS.h.
using elastix::AdaptiveStochasticLBFGS< TElastix >::LineSearchOptimizerPointer = LineSearchOptimizerType::Pointer |
Definition at line 149 of file elxAdaptiveStochasticLBFGS.h.
using elastix::AdaptiveStochasticLBFGS< TElastix >::LineSearchOptimizerType = itk::LineSearchOptimizer |
Definition at line 147 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 236 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 281 of file elxAdaptiveStochasticLBFGS.h.
using elastix::AdaptiveStochasticLBFGS< TElastix >::Pointer = itk::SmartPointer<Self> |
Definition at line 114 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Other protected typedef
Definition at line 272 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
For L-BFGS usage.
Definition at line 284 of file elxAdaptiveStochasticLBFGS.h.
using elastix::AdaptiveStochasticLBFGS< TElastix >::Self = AdaptiveStochasticLBFGS |
Standard ITK.
Definition at line 111 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 133 of file elxOptimizerBase.h.
using elastix::AdaptiveStochasticLBFGS< TElastix >::SizeValueType = itk::SizeValueType |
Definition at line 138 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 285 of file elxAdaptiveStochasticLBFGS.h.
using elastix::AdaptiveStochasticLBFGS< TElastix >::Superclass1 = AdaptiveStochasticLBFGSOptimizer |
Definition at line 112 of file elxAdaptiveStochasticLBFGS.h.
using elastix::AdaptiveStochasticLBFGS< TElastix >::Superclass2 = OptimizerBase<TElastix> |
Definition at line 113 of file elxAdaptiveStochasticLBFGS.h.
using elastix::AdaptiveStochasticLBFGS< TElastix >::ThreadIdType = unsigned int |
Type to count and reference number of threads
Definition at line 224 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Typedefs for support of sparse Jacobians and AdvancedTransforms.
Definition at line 275 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 242 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 286 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
|
overrideprotecteddefault |
|
protectedvirtual |
Helper function that adds a random perturbation delta to the input parameters, with delta ~ sigma * N(0,I). Used by SampleGradients.
|
overridevirtual |
AdvanceOneStep.
Reimplemented from itk::StochasticGradientDescentOptimizer.
|
staticprivate |
The callback function.
|
overridevirtual |
Reimplemented from elastix::BaseComponent.
|
overridevirtual |
Reimplemented from elastix::BaseComponent.
|
overridevirtual |
Reimplemented from elastix::BaseComponent.
|
protectedvirtual |
|
protectedvirtual |
Select different method to estimate some reasonable values for the parameters SP_a, SP_alpha (=1), SigmoidMin, SigmoidMax (=1), and SigmoidScale.
|
protectedvirtual |
Original estimation method to get the reasonable values for the parameters SP_a, SP_alpha (=1), SigmoidMin, SigmoidMax (=1), and SigmoidScale.
|
protectedvirtual |
Estimates some reasonable values for the parameters using displacement distribution SP_a, SP_alpha (=1)
|
overridevirtual |
Reimplemented from elastix::BaseComponent.
|
overridevirtual |
Methods invoked by elastix, in which parameters can be set and progress information can be printed.
Reimplemented from elastix::BaseComponent.
|
protectedvirtual |
Compute H0
Override this method if not satisfied with the default choice.
|
protectedvirtual |
Compute -Hg
COMPUTE -H*G USING THE FORMULA GIVEN IN: Nocedal, J. 1980, "Updating quasi-Newton matrices with limited storage", Mathematics of Computation, Vol.24, No.151, pp. 773-782.
elastix::AdaptiveStochasticLBFGS< TElastix >::elxClassNameMacro | ( | "AdaptiveStochasticLBFGS< TElastix >" | ) |
Name of this class. Use this name in the parameter file to select this specific optimizer. example: (Optimizer "AdaptiveStochasticLBFGS")
|
virtual |
|
virtual |
|
virtual |
Run-time type information (and related methods).
Reimplemented from itk::AdaptiveStochasticLBFGSOptimizer.
|
virtual |
Get the MaximumNumberOfSamplingAttempts.
|
virtual |
|
protectedvirtual |
Helper function, which calls GetScaledValueAndDerivative and does some exception handling. Used by SampleGradients.
elastix::AdaptiveStochasticLBFGS< TElastix >::ITK_DISALLOW_COPY_AND_MOVE | ( | AdaptiveStochasticLBFGS< TElastix > | ) |
|
protected |
|
protected |
|
virtual |
LBFGS Update step.
|
override |
Stop optimization and pass on exception.
|
static |
Method for creation through the object factory.
|
overridevirtual |
If automatic gain estimation is desired, then estimate SP_a, SP_alpha SigmoidScale, SigmoidMax, SigmoidMin. After that call Superclass' implementation.
Reimplemented from itk::StochasticGradientDescentOptimizer.
|
protectedvirtual |
Measure some derivatives, exact and approximated. Returns the squared magnitude of the gradient and approximation error. Needed for the automatic parameter estimation. Gradients are measured at position mu_n, which are generated according to: mu_n - mu_0 ~ N(0, perturbationSigma^2 I ); gg = g^T g, etc.
|
virtual |
Set/Get whether automatic LBFGS step size estimation is desired.
|
virtual |
Set/Get whether automatic parameter estimation is desired. If true, make sure to set the maximum step length.
The following parameters are automatically determined: SP_a, SP_alpha (=1), SigmoidMin, SigmoidMax (=1), SigmoidScale. A usually suitable value for SP_A is 20, which is the default setting, if not specified by the user.
|
virtual |
Set the MaximumNumberOfSamplingAttempts.
|
virtual |
Set/Get maximum step length.
|
inline |
Set the number of threads.
Definition at line 228 of file elxAdaptiveStochasticLBFGS.h.
|
override |
Check if any scales are set, and set the UseScales flag on or off; after that call the superclass' implementation.
|
overridevirtual |
Stop optimization.
Reimplemented from itk::StochasticGradientDescentOptimizer.
|
protectedvirtual |
Store s = x_k - x_k-1 and y = g_k - g_k-1 in m_S and m_Y, and store 1/(ys) in m_Rho.
|
inlineprivate |
The threaded implementation of AdvanceOneStep().
|
private |
Definition at line 393 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
The transform stored as AdvancedTransform
Definition at line 301 of file elxAdaptiveStochasticLBFGS.h.
|
private |
Definition at line 411 of file elxAdaptiveStochasticLBFGS.h.
|
private |
Definition at line 410 of file elxAdaptiveStochasticLBFGS.h.
|
private |
Definition at line 418 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 384 of file elxAdaptiveStochasticLBFGS.h.
|
private |
Definition at line 416 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 382 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 389 of file elxAdaptiveStochasticLBFGS.h.
|
private |
Private variables for band size estimation of covariance matrix.
Definition at line 423 of file elxAdaptiveStochasticLBFGS.h.
|
private |
Private variables for the sampling attempts.
Definition at line 415 of file elxAdaptiveStochasticLBFGS.h.
|
private |
Definition at line 412 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 381 of file elxAdaptiveStochasticLBFGS.h.
|
private |
Definition at line 424 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Some options for automatic parameter estimation.
Definition at line 296 of file elxAdaptiveStochasticLBFGS.h.
|
private |
Definition at line 425 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 297 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 298 of file elxAdaptiveStochasticLBFGS.h.
|
private |
Definition at line 426 of file elxAdaptiveStochasticLBFGS.h.
|
private |
Definition at line 430 of file elxAdaptiveStochasticLBFGS.h.
|
private |
Definition at line 420 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Setting: the minimum gradient magnitude.
The optimizer stops when: ||CurrentGradient|| < GradientMagnitudeTolerance * max(1, ||CurrentPosition||)
Definition at line 379 of file elxAdaptiveStochasticLBFGS.h.
|
private |
Definition at line 417 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 383 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
RandomGenerator for AddRandomPerturbation.
Definition at line 304 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 386 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 387 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Variable to store the automatically determined settings for each resolution.
Definition at line 293 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 306 of file elxAdaptiveStochasticLBFGS.h.
|
private |
Definition at line 433 of file elxAdaptiveStochasticLBFGS.h.
|
private |
The flag of using noise compensation.
Definition at line 429 of file elxAdaptiveStochasticLBFGS.h.
|
private |
Definition at line 431 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 390 of file elxAdaptiveStochasticLBFGS.h.
|
protected |
Definition at line 388 of file elxAdaptiveStochasticLBFGS.h.
Generated on 2024-07-17 for elastix by 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) |