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

#include <elxStandardGradientDescent.h>

Detailed Description

template<class TElastix>
class elastix::StandardGradientDescent< TElastix >

A gradient descent optimizer with a decaying gain.

This class is a wrap around the StandardGradientDescentOptimizer class. It takes care of setting parameters and printing progress information. For more information about the optimisation method, please read the documentation of the StandardGradientDescentOptimizer class.

The parameters used in this class are:

Parameters

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

MaximumNumberOfIterations: The maximum number of iterations in each resolution.
example: (MaximumNumberOfIterations 100 100 50)
Default/recommended value: 500.

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.

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.

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 is 50.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 is 0.602.

See also
StandardGradientDescentOptimizer

Definition at line 68 of file elxStandardGradientDescent.h.

Inheritance diagram for elastix::StandardGradientDescent< TElastix >:

Public Types

using ConstPointer = itk::SmartPointer<const Self>
 
using ITKBaseType = typename Superclass2::ITKBaseType
 
using Pointer = itk::SmartPointer<Self>
 
using Self = StandardGradientDescent
 
using Superclass1 = StandardGradientDescentOptimizer
 
using Superclass2 = OptimizerBase<TElastix>
 
- 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 AfterEachIteration () override
 
void AfterEachResolution () override
 
void AfterRegistration () override
 
void BeforeEachResolution () override
 
void BeforeRegistration () override
 
 elxClassNameMacro ("StandardGradientDescent")
 
virtual const char * GetClassName () const
 
virtual const unsigned long & GetMaximumNumberOfSamplingAttempts ()
 
 ITK_DISALLOW_COPY_AND_MOVE (StandardGradientDescent)
 
void MetricErrorResponse (itk::ExceptionObject &err) override
 
void SetCurrentPositionPublic (const ParametersType &param) override
 
virtual void SetMaximumNumberOfSamplingAttempts (unsigned long _arg)
 
void StartOptimization () override
 
- 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 ResumeOptimization ()
 
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 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::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 Member Functions

 StandardGradientDescent ()
 
 ~StandardGradientDescent () override=default
 
- Protected Member Functions inherited from itk::StandardGradientDescentOptimizer
virtual double Compute_a (double k) const
 
 StandardGradientDescentOptimizer ()
 
virtual void UpdateCurrentTime ()
 
 ~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
 

Private Attributes

 elxOverrideGetSelfMacro
 
unsigned long m_CurrentNumberOfSamplingAttempts
 
unsigned long m_MaximumNumberOfSamplingAttempts
 
unsigned long m_PreviousErrorAtIteration
 

Additional Inherited Members

- Protected Types inherited from elastix::OptimizerBase< TElastix >
using SettingsVectorType = typename std::vector<SettingsType>
 
- Static Protected Member Functions inherited from elastix::OptimizerBase< TElastix >
static void PrintSettingsVector (const SettingsVectorType &settings)
 
- 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 {}
 

Member Typedef Documentation

◆ ConstPointer

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

Definition at line 80 of file elxStandardGradientDescent.h.

◆ ITKBaseType

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

Definition at line 102 of file elxStandardGradientDescent.h.

◆ Pointer

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

Definition at line 79 of file elxStandardGradientDescent.h.

◆ Self

template<class TElastix >
using elastix::StandardGradientDescent< TElastix >::Self = StandardGradientDescent

Standard ITK.

Definition at line 76 of file elxStandardGradientDescent.h.

◆ Superclass1

template<class TElastix >
using elastix::StandardGradientDescent< TElastix >::Superclass1 = StandardGradientDescentOptimizer

Definition at line 77 of file elxStandardGradientDescent.h.

◆ Superclass2

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

Definition at line 78 of file elxStandardGradientDescent.h.

Constructor & Destructor Documentation

◆ StandardGradientDescent()

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

◆ ~StandardGradientDescent()

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

Member Function Documentation

◆ AfterEachIteration()

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

Reimplemented from elastix::BaseComponent.

◆ AfterEachResolution()

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

Reimplemented from elastix::BaseComponent.

◆ AfterRegistration()

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

Reimplemented from elastix::BaseComponent.

◆ BeforeEachResolution()

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

Reimplemented from elastix::BaseComponent.

◆ BeforeRegistration()

template<class TElastix >
void elastix::StandardGradientDescent< 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::StandardGradientDescent< TElastix >::elxClassNameMacro ( "StandardGradientDescent< TElastix >" )

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

◆ GetClassName()

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

Run-time type information (and related methods).

Reimplemented from itk::StandardGradientDescentOptimizer.

◆ GetMaximumNumberOfSamplingAttempts()

template<class TElastix >
virtual const unsigned long & elastix::StandardGradientDescent< TElastix >::GetMaximumNumberOfSamplingAttempts ( )
virtual

Get the MaximumNumberOfSamplingAttempts.

◆ ITK_DISALLOW_COPY_AND_MOVE()

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

◆ MetricErrorResponse()

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

Stop optimisation and pass on exception.

◆ New()

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

Method for creation through the object factory.

◆ SetCurrentPositionPublic()

template<class TElastix >
void elastix::StandardGradientDescent< TElastix >::SetCurrentPositionPublic ( const ParametersType & param)
inlineoverridevirtual

Add SetCurrentPositionPublic, which calls the protected SetCurrentPosition of the itkStandardGradientDescentOptimizer class.

Reimplemented from elastix::OptimizerBase< TElastix >.

Definition at line 137 of file elxStandardGradientDescent.h.

◆ SetMaximumNumberOfSamplingAttempts()

template<class TElastix >
virtual void elastix::StandardGradientDescent< TElastix >::SetMaximumNumberOfSamplingAttempts ( unsigned long _arg)
virtual

Set the MaximumNumberOfSamplingAttempts.

◆ StartOptimization()

template<class TElastix >
void elastix::StandardGradientDescent< 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::StandardGradientDescent< TElastix >::elxOverrideGetSelfMacro
private

Definition at line 154 of file elxStandardGradientDescent.h.

◆ m_CurrentNumberOfSamplingAttempts

template<class TElastix >
unsigned long elastix::StandardGradientDescent< TElastix >::m_CurrentNumberOfSamplingAttempts
private

Definition at line 158 of file elxStandardGradientDescent.h.

◆ m_MaximumNumberOfSamplingAttempts

template<class TElastix >
unsigned long elastix::StandardGradientDescent< TElastix >::m_MaximumNumberOfSamplingAttempts
private

Private variables for the sampling attempts.

Definition at line 157 of file elxStandardGradientDescent.h.

◆ m_PreviousErrorAtIteration

template<class TElastix >
unsigned long elastix::StandardGradientDescent< TElastix >::m_PreviousErrorAtIteration
private

Definition at line 159 of file elxStandardGradientDescent.h.



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