go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elastix::PreconditionedStochasticGradientDescent< TElastix > Class Template Reference

#include <elxPreconditionedStochasticGradientDescent.h>

Detailed Description

template<class TElastix>
class elastix::PreconditionedStochasticGradientDescent< TElastix >

A gradient descent optimizer with an adaptive gain.

This class is a wrap around the PreconditionedASGDOptimizer class. It takes care of setting parameters and printing progress information. For more information about the optimization method, please read the documentation of the PreconditionedASGDOptimizer 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, B.P.F. Lelieveldt, M. Staring An efficient preconditioner for stochastic gradient descent optimization of image registration IEEE Transactions on Medical Imaging, 2019 https://doi.org/10.1109/TMI.2019.2897943

The parameters used in this class are:

Parameters

Optimizer: Select this optimizer as follows:
(Optimizer "PreconditionedStochasticGradientDescent")

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.

StepSizeStrategy: When this parameter is set to "true", the adaptive step size mechanism described in the documentation of itk::itkPreconditionedASGDOptimizer is used. The parameter can be specified for each resolution, or for all resolutions at once.
example: (StepSizeStrategy "Adaptive")
Default/recommend value: "Adaptive", 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 $\delta$. 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.

SP_a: The gain $a(k)$ at each iteration $k$ is defined by
$a(k) =  SP\_a / (SP\_A + k + 1)^{SP\_alpha}$.
SP_a can be defined for each resolution.
example: (SP_a 3200.0 3200.0 1600.0)
The default value is 400.0. Tuning this variable for you specific problem is recommended. Alternatively set the AutomaticParameterEstimation to "true". In that case, you do not need to specify SP_a. SP_a has no influence when AutomaticParameterEstimation is used.

SP_A: The gain $a(k)$ at each iteration $k$ is defined by
$a(k) =  SP\_a / (SP\_A + k + 1)^{SP\_alpha}$.
SP_A can be defined for each resolution.
example: (SP_A 50.0 50.0 100.0)
The default/recommended value for this particular optimizer is 20.0.

SP_alpha: The gain $a(k)$ at each iteration $k$ is defined by
$a(k) =  SP\_a / (SP\_A + k + 1)^{SP\_alpha}$.
SP_alpha can be defined for each resolution.
example: (SP_alpha 0.602 0.602 0.602)
The default/recommended value for this particular optimizer is 1.0. Alternatively set the AutomaticParameterEstimation to "true". In that case, you do not need to specify SP_alpha. SP_alpha has no influence when AutomaticParameterEstimation is used.

SigmoidMax: The maximum of the sigmoid function ( $f_{max}$). Must be larger than 0. The parameter can be specified for each resolution, or for all resolutions at once.
example: (SigmoidMax 1.0)
Default/recommended value: 1.0. This parameter has no influence when AutomaticParameterEstimation is used. In that case, always a value 1.0 is used.

SigmoidMin: The minimum of the sigmoid function ( $f_{min}$). Must be smaller than 0. The parameter can be specified for each resolution, or for all resolutions at once.
example: (SigmoidMin -0.8)
Default value: -0.8. This parameter has no influence when AutomaticParameterEstimation is used. In that case, the value is automatically determined, depending on the images, metric etc.

SigmoidScale: The scale/width of the sigmoid function ( $\omega$). The parameter can be specified for each resolution, or for all resolutions at once.
example: (SigmoidScale 0.00001)
Default value: 1e-8. This parameter has no influence when AutomaticParameterEstimation is used. In that case, the value is automatically determined, depending on the images, metric etc.

SigmoidInitialTime: the initial time input for the sigmoid ( $t_0$). Must be larger than 0.0. The parameter can be specified for each resolution, or for all resolutions at once.
example: (SigmoidInitialTime 0.0 5.0 5.0)
Default value: 0.0. When increased, the optimization starts with smaller steps, leaving the possibility to increase the steps when necessary. If set to 0.0, the method starts with with the largest step allowed.

NumberOfGradientMeasurements: Number of gradients N to estimate the average square magnitudes of the exact gradient and the approximation error. The parameter can be specified for each resolution, or for all resolutions at once.
example: (NumberOfGradientMeasurements 10)
Default value: 0, which means that the value is automatically estimated. In principle, the more the better, but the slower. In practice N=10 is usually sufficient. But the automatic estimation achieved by N=0 also works good. The parameter has only influence when AutomaticParameterEstimation is used.

NumberOfJacobianMeasurements: The number of voxels M where the Jacobian is measured, which is used to estimate the covariance matrix. The parameter can be specified for each resolution, or for all resolutions at once.
example: (NumberOfJacobianMeasurements 5000 10000 20000)
Default value: M = max( 1000, nrofparams ), with nrofparams the number of transform parameters. This is a rather crude rule of thumb, which seems to work in practice. In principle, the more the better, but the slower. The parameter has only influence when AutomaticParameterEstimation is used.

NumberOfSamplesForNoiseCompensationFactor: The number of image samples used to compute the 'exact' gradient. The samples are chosen on a uniform grid. The parameter can be specified for each resolution, or for all resolutions at once.
example: (NumberOfSamplesForNoiseCompensationFactor 100000)
Default/recommended: 100000. This works in general. If the image is smaller, the number of samples is automatically reduced. In principle, the more the better, but the slower. The parameter has only influence when AutomaticParameterEstimation is used.

m_NumberOfSamplesForPrecondition: The number of image samples used to compute the gradient for preconditioner. The samples are chosen on a random sampler. The parameter can be specified for each resolution, or for all resolutions at once.
example: (NumberOfSamplesForPrecondition 500000)
Default/recommended: 500000. This works in general. If the image is smaller, the number of samples is automatically reduced. In principle, the more the better, but the slower. The parameter has only influence when AutomaticParameterEstimation is used.

RegularizationKappa: Selects for the preconditioner regularization. The parameter can be specified for each resolution, or for all resolutions at once.
example: (RegularizationKappa 0.9)

Todo
: this class contains a lot of functional code, which actually does not belong here.
See also
PreconditionedASGDOptimizer

Definition at line 178 of file elxPreconditionedStochasticGradientDescent.h.

Inheritance diagram for elastix::PreconditionedStochasticGradientDescent< TElastix >:

Public Types

using ConstPointer = itk::SmartPointer<const Self>
 
using ITKBaseType = typename Superclass2::ITKBaseType
 
using Pointer = itk::SmartPointer<Self>
 
using Self = PreconditionedStochasticGradientDescent
 
using SizeValueType = itk::SizeValueType
 
using Superclass1 = PreconditionedASGDOptimizer
 
using Superclass2 = OptimizerBase<TElastix>
 
- Public Types inherited from itk::PreconditionedASGDOptimizer
using ConstPointer = SmartPointer<const Self>
 
using Pointer = SmartPointer<Self>
 
using Self = PreconditionedASGDOptimizer
 
using Superclass = StandardGradientDescentOptimizer
 
- Public Types inherited from itk::StandardGradientDescentOptimizer
using ConstPointer = SmartPointer<const Self>
 
using Pointer = SmartPointer<Self>
 
using ScaledCostFunctionPointer
 
using ScaledCostFunctionType
 
using ScalesType
 
using Self = StandardGradientDescentOptimizer
 
enum  StopConditionType
 
using Superclass = GradientDescentOptimizer2
 
- Public Types inherited from itk::GradientDescentOptimizer2
using ConstPointer = SmartPointer<const Self>
 
using Pointer = SmartPointer<Self>
 
using ScaledCostFunctionPointer
 
using ScaledCostFunctionType
 
using ScalesType
 
using Self = GradientDescentOptimizer2
 
enum  StopConditionType { MaximumNumberOfIterations , MetricError , MinimumStepSize }
 
using Superclass = ScaledSingleValuedNonLinearOptimizer
 
- Public Types inherited from itk::ScaledSingleValuedNonLinearOptimizer
using ConstPointer = SmartPointer<const Self>
 
using Pointer = SmartPointer<Self>
 
using ScaledCostFunctionPointer = ScaledCostFunctionType::Pointer
 
using ScaledCostFunctionType = ScaledSingleValuedCostFunction
 
using ScalesType = NonLinearOptimizer::ScalesType
 
using Self = ScaledSingleValuedNonLinearOptimizer
 
using Superclass = SingleValuedNonLinearOptimizer
 
- Public Types inherited from elastix::OptimizerBase< TElastix >
using ElastixType
 
using ITKBaseType = itk::Optimizer
 
using ParametersType = typename ITKBaseType::ParametersType
 
using RegistrationType
 
using Self = OptimizerBase
 
using Superclass = BaseComponentSE<TElastix>
 
- Public Types inherited from elastix::BaseComponentSE< TElastix >
using ElastixType = TElastix
 
using RegistrationType = typename ElastixType::RegistrationBaseType
 
using Self = BaseComponentSE
 
using Superclass = BaseComponent
 

Public Member Functions

void AdvanceOneStep () override
 
void AfterEachIteration () override
 
void AfterEachResolution () override
 
void AfterRegistration () override
 
void BeforeEachResolution () override
 
void BeforeRegistration () override
 
 elxClassNameMacro ("PreconditionedStochasticGradientDescent")
 
virtual bool GetAutomaticParameterEstimation () const
 
virtual const char * GetClassName () const
 
virtual const SizeValueTypeGetMaximumNumberOfSamplingAttempts ()
 
virtual const doubleGetMaximumStepLength ()
 
virtual const doubleGetRegularizationKappa ()
 
 ITK_DISALLOW_COPY_AND_MOVE (PreconditionedStochasticGradientDescent)
 
void MetricErrorResponse (itk::ExceptionObject &err) override
 
void ResumeOptimization () override
 
virtual void SetAutomaticParameterEstimation (bool _arg)
 
virtual void SetMaximumNumberOfSamplingAttempts (SizeValueType _arg)
 
virtual void SetMaximumStepLength (double _arg)
 
virtual void SetRegularizationKappa (double _arg)
 
void StartOptimization () override
 
- Public Member Functions inherited from itk::PreconditionedASGDOptimizer
virtual const ParametersType & GetPreconditionVector ()
 
virtual double GetSigmoidMax () const
 
virtual double GetSigmoidMin () const
 
virtual double GetSigmoidScale () const
 
virtual bool GetUseAdaptiveStepSizes () const
 
 ITK_DISALLOW_COPY_AND_MOVE (PreconditionedASGDOptimizer)
 
virtual void SetSigmoidMax (double _arg)
 
virtual void SetSigmoidMin (double _arg)
 
virtual void SetSigmoidScale (double _arg)
 
virtual void SetUseAdaptiveStepSizes (bool _arg)
 
- Public Member Functions inherited from itk::StandardGradientDescentOptimizer
void AdvanceOneStep () override
 
virtual double GetCurrentTime () const
 
virtual double GetInitialTime () const
 
virtual double GetParam_A () const
 
virtual double GetParam_a () const
 
virtual double GetParam_alpha () const
 
 ITK_DISALLOW_COPY_AND_MOVE (StandardGradientDescentOptimizer)
 
virtual void ResetCurrentTimeToInitialTime ()
 
virtual void SetInitialTime (double _arg)
 
virtual void SetParam_A (double _arg)
 
virtual void SetParam_a (double _arg)
 
virtual void SetParam_alpha (double _arg)
 
void StartOptimization () override
 
- Public Member Functions inherited from itk::GradientDescentOptimizer2
virtual unsigned int GetCurrentIteration () const
 
virtual const DerivativeType & GetGradient ()
 
virtual const doubleGetLearningRate ()
 
virtual const unsigned long & GetNumberOfIterations ()
 
virtual const DerivativeType & GetSearchDirection ()
 
virtual const StopConditionTypeGetStopCondition ()
 
virtual const doubleGetValue ()
 
 ITK_DISALLOW_COPY_AND_MOVE (GradientDescentOptimizer2)
 
virtual void MetricErrorResponse (ExceptionObject &err)
 
virtual void SetLearningRate (double _arg)
 
virtual void SetNumberOfIterations (unsigned long _arg)
 
void StartOptimization () override
 
virtual void StopOptimization ()
 
- Public Member Functions inherited from itk::ScaledSingleValuedNonLinearOptimizer
const ParametersType & GetCurrentPosition () const override
 
virtual bool GetMaximize () const
 
virtual const ScaledCostFunctionTypeGetScaledCostFunction ()
 
virtual const ParametersType & GetScaledCurrentPosition ()
 
bool GetUseScales () const
 
virtual void InitializeScales ()
 
 ITK_DISALLOW_COPY_AND_MOVE (ScaledSingleValuedNonLinearOptimizer)
 
virtual void MaximizeOff ()
 
virtual void MaximizeOn ()
 
void SetCostFunction (CostFunctionType *costFunction) override
 
virtual void SetMaximize (bool _arg)
 
virtual void SetUseScales (bool arg)
 
- Public Member Functions inherited from elastix::OptimizerBase< TElastix >
void AfterRegistrationBase () override
 
void BeforeEachResolutionBase () override
 
ITKBaseTypeGetAsITKBaseType ()
 
const ITKBaseTypeGetAsITKBaseType () const
 
 ITK_DISALLOW_COPY_AND_MOVE (OptimizerBase)
 
virtual void SetCurrentPositionPublic (const ParametersType &param)
 
virtual void SetSinusScales (double amplitude, double frequency, unsigned long numberOfParameters)
 
- Public Member Functions inherited from elastix::BaseComponentSE< TElastix >
void AddTargetCellToIterationInfo (const char *const name)
 
const ConfigurationGetConfiguration () const
 
ElastixTypeGetElastix () const
 
auto & GetIterationInfoAt (const char *const name)
 
RegistrationTypeGetRegistration () const
 
 ITK_DISALLOW_COPY_AND_MOVE (BaseComponentSE)
 
void RemoveTargetCellFromIterationInfo (const char *const name)
 
void SetConfiguration (const Configuration *_arg)
 
void SetElastix (ElastixType *_arg)
 
- Public Member Functions inherited from elastix::BaseComponent
virtual void AfterEachIterationBase ()
 
virtual void AfterEachResolutionBase ()
 
virtual int BeforeAll ()
 
virtual int BeforeAllBase ()
 
virtual void BeforeRegistrationBase ()
 
virtual const char * elxGetClassName () const
 
const char * GetComponentLabel () const
 
 ITK_DISALLOW_COPY_AND_MOVE (BaseComponent)
 
 itkTypeMacroNoParent (BaseComponent)
 
void SetComponentLabel (const char *label, unsigned int idx)
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from itk::PreconditionedASGDOptimizer
static Pointer New ()
 
- Static Public Member Functions inherited from itk::StandardGradientDescentOptimizer
static Pointer New ()
 
- Static Public Member Functions inherited from itk::GradientDescentOptimizer2
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 Types

using AdvancedBSplineDeformableTransformType
 
using AdvancedTransformPointer = typename AdvancedTransformType::Pointer
 
using AdvancedTransformType
 
using BSplineTransformBasePointer = typename AdvancedBSplineDeformableTransformType::Pointer
 
using ComputeDisplacementDistributionType = itk::ComputeDisplacementDistribution<FixedImageType, TransformType>
 
using CoordinateRepresentationType = typename TransformType::ScalarType
 
using FixedImageIndexType = typename FixedImageType::IndexType
 
using FixedImagePointType = typename FixedImageType::PointType
 
using FixedImageRegionType = typename FixedImageType::RegionType
 
using FixedImageType = typename RegistrationType::FixedImageType
 
using ImageGridSamplerPointer = typename ImageGridSamplerType::Pointer
 
using ImageGridSamplerType = itk::ImageGridSampler<FixedImageType>
 
using ImageRandomCoordinateSamplerPointer = typename ImageRandomCoordinateSamplerType::Pointer
 
using ImageRandomCoordinateSamplerType = itk::ImageRandomCoordinateSampler<FixedImageType>
 
using ImageRandomSamplerBasePointer = typename ImageRandomSamplerBaseType::Pointer
 
using ImageRandomSamplerBaseType = itk::ImageRandomSamplerBase<FixedImageType>
 
using ImageRandomSamplerPointer = typename ImageRandomSamplerType::Pointer
 
using ImageRandomSamplerType = itk::ImageRandomSampler<FixedImageType>
 
using ImageSampleContainerPointer = typename ImageSampleContainerType::Pointer
 
using ImageSampleContainerType = typename ImageGridSamplerType::ImageSampleContainerType
 
using ImageSamplerBasePointer = typename ImageSamplerBaseType::Pointer
 
using ImageSamplerBaseType = itk::ImageSamplerBase<FixedImageType>
 
using itkRegistrationType = typename RegistrationType::ITKBaseType
 
using JacobianType = typename TransformType::JacobianType
 
using JacobianValueType = typename JacobianType::ValueType
 
using MovingImageType = typename RegistrationType::MovingImageType
 
using NonZeroJacobianIndicesType = typename AdvancedTransformType::NonZeroJacobianIndicesType
 
using OutputImageType = typename ElastixType::FixedImageType
 
using PreconditionerEstimationPointer = typename PreconditionerEstimationType::Pointer
 
using PreconditionerEstimationType
 
using RandomGeneratorPointer = typename RandomGeneratorType::Pointer
 
using RandomGeneratorType = itk::Statistics::MersenneTwisterRandomVariateGenerator
 
using SettingsVectorType
 
using TransformJacobianType = JacobianType
 
using TransformType = typename itkRegistrationType::TransformType
 
- Protected Types inherited from elastix::OptimizerBase< TElastix >
using SettingsVectorType = typename std::vector<SettingsType>
 

Protected Member Functions

virtual void AddRandomPerturbation (ParametersType &parameters, double sigma)
 
virtual void AutomaticPreconditionerEstimation ()
 
virtual void GetScaledDerivativeWithExceptionHandling (const ParametersType &parameters, DerivativeType &derivative)
 
 itkStaticConstMacro (FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
 
 itkStaticConstMacro (MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
 
 PreconditionedStochasticGradientDescent ()
 
virtual void SampleGradients (const ParametersType &mu0, double perturbationSigma, double &gg, double &ee)
 
 ~PreconditionedStochasticGradientDescent () override=default
 
- Protected Member Functions inherited from itk::PreconditionedASGDOptimizer
 PreconditionedASGDOptimizer ()
 
void UpdateCurrentTime () override
 
 ~PreconditionedASGDOptimizer () override=default
 
- Protected Member Functions inherited from itk::StandardGradientDescentOptimizer
virtual double Compute_a (double k) const
 
 StandardGradientDescentOptimizer ()
 
 ~StandardGradientDescentOptimizer () override=default
 
- Protected Member Functions inherited from itk::GradientDescentOptimizer2
 GradientDescentOptimizer2 ()
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
 ~GradientDescentOptimizer2 () override=default
 
- Protected Member Functions inherited from itk::ScaledSingleValuedNonLinearOptimizer
virtual void GetScaledDerivative (const ParametersType &parameters, DerivativeType &derivative) const
 
virtual MeasureType GetScaledValue (const ParametersType &parameters) const
 
virtual void GetScaledValueAndDerivative (const ParametersType &parameters, MeasureType &value, DerivativeType &derivative) const
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
 ScaledSingleValuedNonLinearOptimizer ()
 
void SetCurrentPosition (const ParametersType &param) override
 
virtual void SetScaledCurrentPosition (const ParametersType &parameters)
 
 ~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
 

Protected Attributes

AdvancedTransformPointer m_AdvancedTransform
 
double m_ConditionNumber
 
double m_GlobalStepSize
 
double m_NoiseFactor
 
SizeValueType m_NumberOfGradientMeasurements
 
SizeValueType m_NumberOfJacobianMeasurements
 
SizeValueType m_NumberOfSamplesForNoiseCompensationFactor
 
SizeValueType m_NumberOfSamplesForPrecondition
 
SizeValueType m_NumberOfSpatialSamples
 
RandomGeneratorPointer m_RandomGenerator
 
double m_RegularizationKappa
 
SettingsVectorType m_SettingsVector
 
double m_SigmoidScaleFactor
 
- Protected Attributes inherited from itk::PreconditionedASGDOptimizer
ParametersType m_PreconditionVector {}
 
DerivativeType m_PreviousSearchDirection {}
 
std::string m_StepSizeStrategy {}
 
- Protected Attributes inherited from itk::StandardGradientDescentOptimizer
double m_CurrentTime { 0.0 }
 
bool m_UseConstantStep { false }
 
- Protected Attributes inherited from itk::GradientDescentOptimizer2
DerivativeType m_Gradient {}
 
DerivativeType m_SearchDirection {}
 
StopConditionType m_StopCondition { MaximumNumberOfIterations }
 
- Protected Attributes inherited from itk::ScaledSingleValuedNonLinearOptimizer
ScaledCostFunctionPointer m_ScaledCostFunction {}
 
ParametersType m_ScaledCurrentPosition {}
 
- Protected Attributes inherited from elastix::BaseComponentSE< TElastix >
Configuration::ConstPointer m_Configuration {}
 
itk::WeakPointer< TElastix > m_Elastix {}
 
RegistrationTypem_Registration {}
 

Private Attributes

 elxOverrideGetSelfMacro
 
bool m_AutomaticParameterEstimation
 
bool m_AutomaticParameterEstimationDone
 
SizeValueType m_CurrentNumberOfSamplingAttempts
 
SizeValueType m_MaxBandCovSize
 
SizeValueType m_MaximumNumberOfSamplingAttempts
 
double m_MaximumStepLength
 
double m_MaximumStepLengthRatio
 
SizeValueType m_NumberOfBandStructureSamples
 
bool m_OriginalButSigmoidToDefault
 
SizeValueType m_PreviousErrorAtIteration
 
bool m_UseNoiseCompensation
 

Additional Inherited Members

- Static Protected Member Functions inherited from elastix::OptimizerBase< TElastix >
static void PrintSettingsVector (const SettingsVectorType &settings)
 

Member Typedef Documentation

◆ AdvancedBSplineDeformableTransformType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::AdvancedBSplineDeformableTransformType
protected

◆ AdvancedTransformPointer

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::AdvancedTransformPointer = typename AdvancedTransformType::Pointer
protected

◆ AdvancedTransformType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::AdvancedTransformType
protected
Initial value:
Transform maps points, vectors and covariant vectors from an input space to an output space.

Definition at line 330 of file elxPreconditionedStochasticGradientDescent.h.

◆ BSplineTransformBasePointer

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::BSplineTransformBasePointer = typename AdvancedBSplineDeformableTransformType::Pointer
protected

◆ ComputeDisplacementDistributionType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::ComputeDisplacementDistributionType = itk::ComputeDisplacementDistribution<FixedImageType, TransformType>
protected

◆ ConstPointer

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::ConstPointer = itk::SmartPointer<const Self>

◆ CoordinateRepresentationType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::CoordinateRepresentationType = typename TransformType::ScalarType
protected

◆ FixedImageIndexType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::FixedImageIndexType = typename FixedImageType::IndexType
protected

◆ FixedImagePointType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::FixedImagePointType = typename FixedImageType::PointType
protected

◆ FixedImageRegionType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::FixedImageRegionType = typename FixedImageType::RegionType
protected

◆ FixedImageType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::FixedImageType = typename RegistrationType::FixedImageType
protected

Protected typedefs

Definition at line 286 of file elxPreconditionedStochasticGradientDescent.h.

◆ ImageGridSamplerPointer

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::ImageGridSamplerPointer = typename ImageGridSamplerType::Pointer
protected

◆ ImageGridSamplerType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::ImageGridSamplerType = itk::ImageGridSampler<FixedImageType>
protected

◆ ImageRandomCoordinateSamplerPointer

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::ImageRandomCoordinateSamplerPointer = typename ImageRandomCoordinateSamplerType::Pointer
protected

◆ ImageRandomCoordinateSamplerType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::ImageRandomCoordinateSamplerType = itk::ImageRandomCoordinateSampler<FixedImageType>
protected

◆ ImageRandomSamplerBasePointer

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::ImageRandomSamplerBasePointer = typename ImageRandomSamplerBaseType::Pointer
protected

◆ ImageRandomSamplerBaseType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::ImageRandomSamplerBaseType = itk::ImageRandomSamplerBase<FixedImageType>
protected

◆ ImageRandomSamplerPointer

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::ImageRandomSamplerPointer = typename ImageRandomSamplerType::Pointer
protected

◆ ImageRandomSamplerType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::ImageRandomSamplerType = itk::ImageRandomSampler<FixedImageType>
protected

◆ ImageSampleContainerPointer

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::ImageSampleContainerPointer = typename ImageSampleContainerType::Pointer
protected

◆ ImageSampleContainerType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::ImageSampleContainerType = typename ImageGridSamplerType::ImageSampleContainerType
protected

◆ ImageSamplerBasePointer

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::ImageSamplerBasePointer = typename ImageSamplerBaseType::Pointer
protected

◆ ImageSamplerBaseType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::ImageSamplerBaseType = itk::ImageSamplerBase<FixedImageType>
protected

Samplers:

Definition at line 307 of file elxPreconditionedStochasticGradientDescent.h.

◆ ITKBaseType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::ITKBaseType = typename Superclass2::ITKBaseType

◆ itkRegistrationType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::itkRegistrationType = typename RegistrationType::ITKBaseType
protected

◆ JacobianType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::JacobianType = typename TransformType::JacobianType
protected

◆ JacobianValueType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::JacobianValueType = typename JacobianType::ValueType
protected

◆ MovingImageType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::MovingImageType = typename RegistrationType::MovingImageType
protected

◆ NonZeroJacobianIndicesType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::NonZeroJacobianIndicesType = typename AdvancedTransformType::NonZeroJacobianIndicesType
protected

◆ OutputImageType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::OutputImageType = typename ElastixType::FixedImageType
protected

◆ Pointer

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::Pointer = itk::SmartPointer<Self>

◆ PreconditionerEstimationPointer

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::PreconditionerEstimationPointer = typename PreconditionerEstimationType::Pointer
protected

◆ PreconditionerEstimationType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::PreconditionerEstimationType
protected

◆ RandomGeneratorPointer

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::RandomGeneratorPointer = typename RandomGeneratorType::Pointer
protected

◆ RandomGeneratorType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::RandomGeneratorType = itk::Statistics::MersenneTwisterRandomVariateGenerator
protected

Other protected typedefs

Definition at line 321 of file elxPreconditionedStochasticGradientDescent.h.

◆ Self

Standard ITK.

Definition at line 186 of file elxPreconditionedStochasticGradientDescent.h.

◆ SettingsVectorType

template<class TElastix >
using elastix::OptimizerBase< TElastix >::SettingsVectorType
protected

Definition at line 133 of file elxOptimizerBase.h.

◆ SizeValueType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::SizeValueType = itk::SizeValueType

◆ Superclass1

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::Superclass1 = PreconditionedASGDOptimizer

◆ Superclass2

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::Superclass2 = OptimizerBase<TElastix>

◆ TransformJacobianType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::TransformJacobianType = JacobianType
protected

Typedefs for support of sparse Jacobians and AdvancedTransforms.

Definition at line 325 of file elxPreconditionedStochasticGradientDescent.h.

◆ TransformType

template<class TElastix >
using elastix::PreconditionedStochasticGradientDescent< TElastix >::TransformType = typename itkRegistrationType::TransformType
protected

Constructor & Destructor Documentation

◆ PreconditionedStochasticGradientDescent()

template<class TElastix >
elastix::PreconditionedStochasticGradientDescent< TElastix >::PreconditionedStochasticGradientDescent ( )
protected

◆ ~PreconditionedStochasticGradientDescent()

template<class TElastix >
elastix::PreconditionedStochasticGradientDescent< TElastix >::~PreconditionedStochasticGradientDescent ( )
overrideprotecteddefault

Member Function Documentation

◆ AddRandomPerturbation()

template<class TElastix >
virtual void elastix::PreconditionedStochasticGradientDescent< TElastix >::AddRandomPerturbation ( ParametersType & parameters,
double sigma )
protectedvirtual

Helper function that adds a random perturbation delta to the input parameters, with delta ~ sigma * N(0,I). Used by SampleGradients.

◆ AdvanceOneStep()

template<class TElastix >
void elastix::PreconditionedStochasticGradientDescent< TElastix >::AdvanceOneStep ( )
overridevirtual

Advance one step following the gradient direction.

Reimplemented from itk::GradientDescentOptimizer2.

◆ AfterEachIteration()

template<class TElastix >
void elastix::PreconditionedStochasticGradientDescent< TElastix >::AfterEachIteration ( )
overridevirtual

Reimplemented from elastix::BaseComponent.

◆ AfterEachResolution()

template<class TElastix >
void elastix::PreconditionedStochasticGradientDescent< TElastix >::AfterEachResolution ( )
overridevirtual

Reimplemented from elastix::BaseComponent.

◆ AfterRegistration()

template<class TElastix >
void elastix::PreconditionedStochasticGradientDescent< TElastix >::AfterRegistration ( )
overridevirtual

Reimplemented from elastix::BaseComponent.

◆ AutomaticPreconditionerEstimation()

template<class TElastix >
virtual void elastix::PreconditionedStochasticGradientDescent< TElastix >::AutomaticPreconditionerEstimation ( )
protectedvirtual

Select different method to estimate some reasonable values for the parameters SP_a, SP_alpha (=1), SigmoidMin, SigmoidMax (=1), and SigmoidScale.

◆ BeforeEachResolution()

template<class TElastix >
void elastix::PreconditionedStochasticGradientDescent< TElastix >::BeforeEachResolution ( )
overridevirtual

Reimplemented from elastix::BaseComponent.

◆ BeforeRegistration()

template<class TElastix >
void elastix::PreconditionedStochasticGradientDescent< TElastix >::BeforeRegistration ( )
overridevirtual

Methods invoked by elastix, in which parameters can be set and progress information can be printed.

Reimplemented from elastix::BaseComponent.

◆ elxClassNameMacro()

template<class TElastix >
elastix::PreconditionedStochasticGradientDescent< TElastix >::elxClassNameMacro ( "PreconditionedStochasticGradientDescent< TElastix >" )

Name of this class. Use this name in the parameter file to select this specific optimizer. example: (Optimizer "PreconditionedStochasticGradientDescent")

◆ GetAutomaticParameterEstimation()

template<class TElastix >
virtual bool elastix::PreconditionedStochasticGradientDescent< TElastix >::GetAutomaticParameterEstimation ( ) const
virtual

◆ GetClassName()

template<class TElastix >
virtual const char * elastix::PreconditionedStochasticGradientDescent< TElastix >::GetClassName ( ) const
virtual

Run-time type information (and related methods).

Reimplemented from itk::PreconditionedASGDOptimizer.

◆ GetMaximumNumberOfSamplingAttempts()

template<class TElastix >
virtual const SizeValueType & elastix::PreconditionedStochasticGradientDescent< TElastix >::GetMaximumNumberOfSamplingAttempts ( )
virtual

◆ GetMaximumStepLength()

template<class TElastix >
virtual const double & elastix::PreconditionedStochasticGradientDescent< TElastix >::GetMaximumStepLength ( )
virtual

◆ GetRegularizationKappa()

template<class TElastix >
virtual const double & elastix::PreconditionedStochasticGradientDescent< TElastix >::GetRegularizationKappa ( )
virtual

◆ GetScaledDerivativeWithExceptionHandling()

template<class TElastix >
virtual void elastix::PreconditionedStochasticGradientDescent< TElastix >::GetScaledDerivativeWithExceptionHandling ( const ParametersType & parameters,
DerivativeType & derivative )
protectedvirtual

Helper function, which calls GetScaledValueAndDerivative and does some exception handling. Used by SampleGradients.

◆ ITK_DISALLOW_COPY_AND_MOVE()

template<class TElastix >
elastix::PreconditionedStochasticGradientDescent< TElastix >::ITK_DISALLOW_COPY_AND_MOVE ( PreconditionedStochasticGradientDescent< TElastix > )

◆ itkStaticConstMacro() [1/2]

template<class TElastix >
elastix::PreconditionedStochasticGradientDescent< TElastix >::itkStaticConstMacro ( FixedImageDimension ,
unsigned int ,
FixedImageType::ImageDimension  )
protected

◆ itkStaticConstMacro() [2/2]

template<class TElastix >
elastix::PreconditionedStochasticGradientDescent< TElastix >::itkStaticConstMacro ( MovingImageDimension ,
unsigned int ,
MovingImageType::ImageDimension  )
protected

◆ MetricErrorResponse()

template<class TElastix >
void elastix::PreconditionedStochasticGradientDescent< TElastix >::MetricErrorResponse ( itk::ExceptionObject & err)
override

Stop optimization and pass on exception.

◆ New()

template<class TElastix >
static Pointer elastix::PreconditionedStochasticGradientDescent< TElastix >::New ( )
static

Method for creation through the object factory.

◆ ResumeOptimization()

template<class TElastix >
void elastix::PreconditionedStochasticGradientDescent< TElastix >::ResumeOptimization ( )
overridevirtual

If automatic gain estimation is desired, then estimate SP_a, SP_alpha SigmoidScale, SigmoidMax, SigmoidMin. After that call Superclass' implementation.

Reimplemented from itk::GradientDescentOptimizer2.

◆ SampleGradients()

template<class TElastix >
virtual void elastix::PreconditionedStochasticGradientDescent< TElastix >::SampleGradients ( const ParametersType & mu0,
double perturbationSigma,
double & gg,
double & ee )
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.

◆ SetAutomaticParameterEstimation()

template<class TElastix >
virtual void elastix::PreconditionedStochasticGradientDescent< TElastix >::SetAutomaticParameterEstimation ( bool _arg)
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.

◆ SetMaximumNumberOfSamplingAttempts()

template<class TElastix >
virtual void elastix::PreconditionedStochasticGradientDescent< TElastix >::SetMaximumNumberOfSamplingAttempts ( SizeValueType _arg)
virtual

Set/Get the MaximumNumberOfSamplingAttempts.

◆ SetMaximumStepLength()

template<class TElastix >
virtual void elastix::PreconditionedStochasticGradientDescent< TElastix >::SetMaximumStepLength ( double _arg)
virtual

Set/Get maximum step length.

◆ SetRegularizationKappa()

template<class TElastix >
virtual void elastix::PreconditionedStochasticGradientDescent< TElastix >::SetRegularizationKappa ( double _arg)
virtual

Set/Get regularization value kappa.

◆ StartOptimization()

template<class TElastix >
void elastix::PreconditionedStochasticGradientDescent< TElastix >::StartOptimization ( )
override

Check if any scales are set, and set the UseScales flag on or off; after that call the superclass' implementation.

Field Documentation

◆ elxOverrideGetSelfMacro

template<class TElastix >
elastix::PreconditionedStochasticGradientDescent< TElastix >::elxOverrideGetSelfMacro
private

◆ m_AdvancedTransform

template<class TElastix >
AdvancedTransformPointer elastix::PreconditionedStochasticGradientDescent< TElastix >::m_AdvancedTransform
protected

The transform stored as AdvancedTransform

Definition at line 350 of file elxPreconditionedStochasticGradientDescent.h.

◆ m_AutomaticParameterEstimation

template<class TElastix >
bool elastix::PreconditionedStochasticGradientDescent< TElastix >::m_AutomaticParameterEstimation
private

◆ m_AutomaticParameterEstimationDone

template<class TElastix >
bool elastix::PreconditionedStochasticGradientDescent< TElastix >::m_AutomaticParameterEstimationDone
private

◆ m_ConditionNumber

template<class TElastix >
double elastix::PreconditionedStochasticGradientDescent< TElastix >::m_ConditionNumber
protected

◆ m_CurrentNumberOfSamplingAttempts

template<class TElastix >
SizeValueType elastix::PreconditionedStochasticGradientDescent< TElastix >::m_CurrentNumberOfSamplingAttempts
private

◆ m_GlobalStepSize

template<class TElastix >
double elastix::PreconditionedStochasticGradientDescent< TElastix >::m_GlobalStepSize
protected

◆ m_MaxBandCovSize

template<class TElastix >
SizeValueType elastix::PreconditionedStochasticGradientDescent< TElastix >::m_MaxBandCovSize
private

Private variables for band size estimation of covariance matrix.

Definition at line 404 of file elxPreconditionedStochasticGradientDescent.h.

◆ m_MaximumNumberOfSamplingAttempts

template<class TElastix >
SizeValueType elastix::PreconditionedStochasticGradientDescent< TElastix >::m_MaximumNumberOfSamplingAttempts
private

Private variables for the sampling attempts.

Definition at line 398 of file elxPreconditionedStochasticGradientDescent.h.

◆ m_MaximumStepLength

template<class TElastix >
double elastix::PreconditionedStochasticGradientDescent< TElastix >::m_MaximumStepLength
private

◆ m_MaximumStepLengthRatio

template<class TElastix >
double elastix::PreconditionedStochasticGradientDescent< TElastix >::m_MaximumStepLengthRatio
private

◆ m_NoiseFactor

template<class TElastix >
double elastix::PreconditionedStochasticGradientDescent< TElastix >::m_NoiseFactor
protected

◆ m_NumberOfBandStructureSamples

template<class TElastix >
SizeValueType elastix::PreconditionedStochasticGradientDescent< TElastix >::m_NumberOfBandStructureSamples
private

◆ m_NumberOfGradientMeasurements

template<class TElastix >
SizeValueType elastix::PreconditionedStochasticGradientDescent< TElastix >::m_NumberOfGradientMeasurements
protected

Some options for automatic parameter estimation.

Definition at line 343 of file elxPreconditionedStochasticGradientDescent.h.

◆ m_NumberOfJacobianMeasurements

template<class TElastix >
SizeValueType elastix::PreconditionedStochasticGradientDescent< TElastix >::m_NumberOfJacobianMeasurements
protected

◆ m_NumberOfSamplesForNoiseCompensationFactor

template<class TElastix >
SizeValueType elastix::PreconditionedStochasticGradientDescent< TElastix >::m_NumberOfSamplesForNoiseCompensationFactor
protected

◆ m_NumberOfSamplesForPrecondition

template<class TElastix >
SizeValueType elastix::PreconditionedStochasticGradientDescent< TElastix >::m_NumberOfSamplesForPrecondition
protected

◆ m_NumberOfSpatialSamples

template<class TElastix >
SizeValueType elastix::PreconditionedStochasticGradientDescent< TElastix >::m_NumberOfSpatialSamples
protected

◆ m_OriginalButSigmoidToDefault

template<class TElastix >
bool elastix::PreconditionedStochasticGradientDescent< TElastix >::m_OriginalButSigmoidToDefault
private

◆ m_PreviousErrorAtIteration

template<class TElastix >
SizeValueType elastix::PreconditionedStochasticGradientDescent< TElastix >::m_PreviousErrorAtIteration
private

◆ m_RandomGenerator

template<class TElastix >
RandomGeneratorPointer elastix::PreconditionedStochasticGradientDescent< TElastix >::m_RandomGenerator
protected

RandomGenerator for AddRandomPerturbation.

Definition at line 353 of file elxPreconditionedStochasticGradientDescent.h.

◆ m_RegularizationKappa

template<class TElastix >
double elastix::PreconditionedStochasticGradientDescent< TElastix >::m_RegularizationKappa
protected

◆ m_SettingsVector

template<class TElastix >
SettingsVectorType elastix::PreconditionedStochasticGradientDescent< TElastix >::m_SettingsVector
protected

Variable to store the automatically determined settings for each resolution.

Definition at line 340 of file elxPreconditionedStochasticGradientDescent.h.

◆ m_SigmoidScaleFactor

template<class TElastix >
double elastix::PreconditionedStochasticGradientDescent< TElastix >::m_SigmoidScaleFactor
protected

◆ m_UseNoiseCompensation

template<class TElastix >
bool elastix::PreconditionedStochasticGradientDescent< TElastix >::m_UseNoiseCompensation
private

The flag of using noise compensation.

Definition at line 408 of file elxPreconditionedStochasticGradientDescent.h.



Generated on 2024-07-17 for elastix by doxygen 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) elastix logo