go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
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

typedef Superclass2::ConfigurationPointer ConfigurationPointer
 
typedef Superclass2::ConfigurationType ConfigurationType
 
typedef itk::SmartPointer< const SelfConstPointer
 
typedef Superclass1::CostFunctionPointer CostFunctionPointer
 
typedef Superclass1::CostFunctionType CostFunctionType
 
typedef Superclass2::ElastixPointer ElastixPointer
 
typedef Superclass2::ElastixType ElastixType
 
typedef Superclass2::ITKBaseType ITKBaseType
 
typedef Superclass1::ParametersType ParametersType
 
typedef itk::SmartPointer< SelfPointer
 
typedef Superclass2::RegistrationPointer RegistrationPointer
 
typedef Superclass2::RegistrationType RegistrationType
 
typedef StandardGradientDescent Self
 
typedef Superclass1::StopConditionType StopConditionType
 
typedef StandardGradientDescentOptimizer Superclass1
 
typedef OptimizerBase< TElastix > Superclass2
 
- Public Types inherited from itk::StandardGradientDescentOptimizer
typedef SmartPointer< const SelfConstPointer
 
typedef Superclass::CostFunctionType CostFunctionType
 
typedef Superclass::DerivativeType DerivativeType
 
typedef Superclass::MeasureType MeasureType
 
typedef Superclass::ParametersType ParametersType
 
typedef SmartPointer< SelfPointer
 
typedef Superclass::ScaledCostFunctionPointer ScaledCostFunctionPointer
 
typedef Superclass::ScaledCostFunctionType ScaledCostFunctionType
 
typedef Superclass::ScalesType ScalesType
 
typedef StandardGradientDescentOptimizer Self
 
typedef Superclass::StopConditionType StopConditionType
 
typedef GradientDescentOptimizer2 Superclass
 
- Public Types inherited from itk::GradientDescentOptimizer2
typedef SmartPointer< const SelfConstPointer
 
typedef Superclass::CostFunctionType CostFunctionType
 
typedef Superclass::DerivativeType DerivativeType
 
typedef Superclass::MeasureType MeasureType
 
typedef Superclass::ParametersType ParametersType
 
typedef SmartPointer< SelfPointer
 
typedef Superclass::ScaledCostFunctionPointer ScaledCostFunctionPointer
 
typedef Superclass::ScaledCostFunctionType ScaledCostFunctionType
 
typedef Superclass::ScalesType ScalesType
 
typedef GradientDescentOptimizer2 Self
 
enum  StopConditionType { MaximumNumberOfIterations , MetricError , MinimumStepSize }
 
typedef ScaledSingleValuedNonLinearOptimizer Superclass
 
- Public Types inherited from itk::ScaledSingleValuedNonLinearOptimizer
typedef SmartPointer< const SelfConstPointer
 
typedef Superclass::CostFunctionType CostFunctionType
 
typedef Superclass::DerivativeType DerivativeType
 
typedef Superclass::MeasureType MeasureType
 
typedef Superclass::ParametersType ParametersType
 
typedef SmartPointer< SelfPointer
 
typedef ScaledCostFunctionType::Pointer ScaledCostFunctionPointer
 
typedef ScaledSingleValuedCostFunction ScaledCostFunctionType
 
typedef NonLinearOptimizer::ScalesType ScalesType
 
typedef ScaledSingleValuedNonLinearOptimizer Self
 
typedef SingleValuedNonLinearOptimizer Superclass
 
- Public Types inherited from elastix::OptimizerBase< TElastix >
typedef Superclass::ConfigurationPointer ConfigurationPointer
 
typedef Superclass::ConfigurationType ConfigurationType
 
typedef Superclass::ElastixPointer ElastixPointer
 
typedef Superclass::ElastixType ElastixType
 
typedef itk::Optimizer ITKBaseType
 
typedef ITKBaseType::ParametersType ParametersType
 
typedef Superclass::RegistrationPointer RegistrationPointer
 
typedef Superclass::RegistrationType RegistrationType
 
typedef OptimizerBase Self
 
typedef BaseComponentSE< TElastix > Superclass
 
- Public Types inherited from elastix::BaseComponentSE< TElastix >
typedef Configuration::Pointer ConfigurationPointer
 
typedef Configuration ConfigurationType
 
typedef itk::WeakPointer< ElastixTypeElastixPointer
 
typedef TElastix ElastixType
 
typedef RegistrationTypeRegistrationPointer
 
typedef ElastixType::RegistrationBaseType RegistrationType
 
typedef BaseComponentSE Self
 
typedef BaseComponent Superclass
 

Public Member Functions

void AfterEachIteration (void) override
 
void AfterEachResolution (void) override
 
void AfterRegistration (void) override
 
void BeforeEachResolution (void) override
 
void BeforeRegistration (void) override
 
 elxClassNameMacro ("StandardGradientDescent")
 
virtual const char * GetClassName () const
 
virtual const unsigned long & GetMaximumNumberOfSamplingAttempts ()
 
void MetricErrorResponse (itk::ExceptionObject &err) override
 
void SetCurrentPositionPublic (const ParametersType &param) override
 
virtual void SetMaximumNumberOfSamplingAttempts (unsigned long _arg)
 
void StartOptimization (void) override
 
- Public Member Functions inherited from itk::StandardGradientDescentOptimizer
void AdvanceOneStep (void) override
 
virtual const char * GetClassName () const
 
virtual double GetCurrentTime () const
 
virtual double GetInitialTime () const
 
virtual double GetParam_a () const
 
virtual double GetParam_A () const
 
virtual double GetParam_alpha () const
 
virtual void ResetCurrentTimeToInitialTime (void)
 
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 (void) override
 
- Public Member Functions inherited from itk::GradientDescentOptimizer2
virtual void AdvanceOneStep (void)
 
virtual const char * GetClassName () const
 
virtual unsigned int GetCurrentIteration () const
 
virtual const DerivativeTypeGetGradient ()
 
virtual const doubleGetLearningRate ()
 
virtual const unsigned long & GetNumberOfIterations ()
 
virtual const DerivativeTypeGetSearchDirection ()
 
virtual const StopConditionTypeGetStopCondition ()
 
virtual const doubleGetValue ()
 
virtual void MetricErrorResponse (ExceptionObject &err)
 
virtual void ResumeOptimization (void)
 
virtual void SetLearningRate (double _arg)
 
virtual void SetNumberOfIterations (unsigned long _arg)
 
virtual void SetUseOpenMP (bool _arg)
 
void StartOptimization (void) override
 
virtual void StopOptimization (void)
 
- Public Member Functions inherited from itk::ScaledSingleValuedNonLinearOptimizer
virtual const char * GetClassName () const
 
const ParametersTypeGetCurrentPosition (void) const override
 
virtual bool GetMaximize () const
 
virtual const ScaledCostFunctionTypeGetScaledCostFunction ()
 
virtual const ParametersTypeGetScaledCurrentPosition ()
 
bool GetUseScales (void) const
 
virtual void InitializeScales (void)
 
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 (void) override
 
void BeforeEachResolutionBase () override
 
virtual ITKBaseTypeGetAsITKBaseType (void)
 
virtual const ITKBaseTypeGetAsITKBaseType (void) const
 
virtual const char * GetClassName () const
 
virtual void SetCurrentPositionPublic (const ParametersType &param)
 
virtual void SetSinusScales (double amplitude, double frequency, unsigned long numberOfParameters)
 
- Public Member Functions inherited from elastix::BaseComponentSE< TElastix >
ConfigurationTypeGetConfiguration (void) const
 
ElastixTypeGetElastix (void) const
 
RegistrationPointer GetRegistration (void) const
 
 ITK_DISALLOW_COPY_AND_ASSIGN (BaseComponentSE)
 
void SetConfiguration (ConfigurationType *_arg)
 
void SetElastix (ElastixType *_arg)
 
- Public Member Functions inherited from elastix::BaseComponent
virtual void AfterEachIteration (void)
 
virtual void AfterEachIterationBase (void)
 
virtual void AfterEachResolution (void)
 
virtual void AfterEachResolutionBase (void)
 
virtual void AfterRegistration (void)
 
virtual void AfterRegistrationBase (void)
 
virtual int BeforeAll (void)
 
virtual int BeforeAllBase (void)
 
virtual void BeforeEachResolution (void)
 
virtual void BeforeEachResolutionBase (void)
 
virtual void BeforeRegistration (void)
 
virtual void BeforeRegistrationBase (void)
 
virtual const char * elxGetClassName (void) const
 
const char * GetComponentLabel (void) const
 
 ITK_DISALLOW_COPY_AND_ASSIGN (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
static std::string ConvertSecondsToDHMS (const double totalSeconds, const unsigned int precision)
 
static void InitializeElastixExecutable ()
 
static bool IsElastixLibrary ()
 

Protected Member Functions

 StandardGradientDescent ()
 
 ~StandardGradientDescent () override
 
- Protected Member Functions inherited from itk::StandardGradientDescentOptimizer
virtual double Compute_a (double k) const
 
 StandardGradientDescentOptimizer ()
 
virtual void UpdateCurrentTime (void)
 
 ~StandardGradientDescentOptimizer () override
 
- Protected Member Functions inherited from itk::GradientDescentOptimizer2
 GradientDescentOptimizer2 ()
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
 ~GradientDescentOptimizer2 () override
 
- 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
 
- Protected Member Functions inherited from elastix::OptimizerBase< TElastix >
virtual bool GetNewSamplesEveryIteration (void) const
 
 OptimizerBase ()
 
virtual void SelectNewSamples (void)
 
 ~OptimizerBase () override
 
- 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 operator= (const Self &)
 
 StandardGradientDescent (const Self &)
 

Private Attributes

unsigned long m_CurrentNumberOfSamplingAttempts
 
unsigned long m_MaximumNumberOfSamplingAttempts
 
unsigned long m_PreviousErrorAtIteration
 

Additional Inherited Members

- Protected Attributes inherited from itk::StandardGradientDescentOptimizer
double m_CurrentTime
 
bool m_UseConstantStep
 
- Protected Attributes inherited from itk::GradientDescentOptimizer2
unsigned long m_CurrentIteration
 
DerivativeType m_Gradient
 
double m_LearningRate
 
unsigned long m_NumberOfIterations
 
DerivativeType m_SearchDirection
 
bool m_Stop
 
StopConditionType m_StopCondition
 
double m_Value
 
- Protected Attributes inherited from itk::ScaledSingleValuedNonLinearOptimizer
ScaledCostFunctionPointer m_ScaledCostFunction
 
ParametersType m_ScaledCurrentPosition
 
- Protected Attributes inherited from elastix::BaseComponentSE< TElastix >
ConfigurationPointer m_Configuration {}
 
ElastixPointer m_Elastix {}
 
RegistrationPointer m_Registration {}
 

Member Typedef Documentation

◆ ConfigurationPointer

template<class TElastix >
typedef Superclass2::ConfigurationPointer elastix::StandardGradientDescent< TElastix >::ConfigurationPointer

Definition at line 104 of file elxStandardGradientDescent.h.

◆ ConfigurationType

template<class TElastix >
typedef Superclass2::ConfigurationType elastix::StandardGradientDescent< TElastix >::ConfigurationType

Definition at line 103 of file elxStandardGradientDescent.h.

◆ ConstPointer

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

Definition at line 81 of file elxStandardGradientDescent.h.

◆ CostFunctionPointer

template<class TElastix >
typedef Superclass1::CostFunctionPointer elastix::StandardGradientDescent< TElastix >::CostFunctionPointer

Definition at line 97 of file elxStandardGradientDescent.h.

◆ CostFunctionType

template<class TElastix >
typedef Superclass1::CostFunctionType elastix::StandardGradientDescent< TElastix >::CostFunctionType

Typedef's inherited from Superclass1, the StandardGradientDescentOptimizer.

Definition at line 96 of file elxStandardGradientDescent.h.

◆ ElastixPointer

template<class TElastix >
typedef Superclass2::ElastixPointer elastix::StandardGradientDescent< TElastix >::ElastixPointer

Definition at line 102 of file elxStandardGradientDescent.h.

◆ ElastixType

template<class TElastix >
typedef Superclass2::ElastixType elastix::StandardGradientDescent< TElastix >::ElastixType

Typedef's inherited from Superclass2, the elastix OptimizerBase .

Definition at line 101 of file elxStandardGradientDescent.h.

◆ ITKBaseType

template<class TElastix >
typedef Superclass2::ITKBaseType elastix::StandardGradientDescent< TElastix >::ITKBaseType

Definition at line 107 of file elxStandardGradientDescent.h.

◆ ParametersType

template<class TElastix >
typedef Superclass1::ParametersType elastix::StandardGradientDescent< TElastix >::ParametersType

Typedef for the ParametersType.

Definition at line 110 of file elxStandardGradientDescent.h.

◆ Pointer

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

Definition at line 80 of file elxStandardGradientDescent.h.

◆ RegistrationPointer

template<class TElastix >
typedef Superclass2::RegistrationPointer elastix::StandardGradientDescent< TElastix >::RegistrationPointer

Definition at line 106 of file elxStandardGradientDescent.h.

◆ RegistrationType

template<class TElastix >
typedef Superclass2::RegistrationType elastix::StandardGradientDescent< TElastix >::RegistrationType

Definition at line 105 of file elxStandardGradientDescent.h.

◆ Self

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

Standard ITK.

Definition at line 77 of file elxStandardGradientDescent.h.

◆ StopConditionType

template<class TElastix >
typedef Superclass1::StopConditionType elastix::StandardGradientDescent< TElastix >::StopConditionType

Definition at line 98 of file elxStandardGradientDescent.h.

◆ Superclass1

template<class TElastix >
typedef StandardGradientDescentOptimizer elastix::StandardGradientDescent< TElastix >::Superclass1

Definition at line 78 of file elxStandardGradientDescent.h.

◆ Superclass2

template<class TElastix >
typedef OptimizerBase< TElastix > elastix::StandardGradientDescent< TElastix >::Superclass2

Definition at line 79 of file elxStandardGradientDescent.h.

Constructor & Destructor Documentation

◆ StandardGradientDescent() [1/2]

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

◆ ~StandardGradientDescent()

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

Definition at line 149 of file elxStandardGradientDescent.h.

◆ StandardGradientDescent() [2/2]

template<class TElastix >
elastix::StandardGradientDescent< TElastix >::StandardGradientDescent ( const Self )
private

Member Function Documentation

◆ AfterEachIteration()

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

Reimplemented from elastix::BaseComponent.

◆ AfterEachResolution()

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

Reimplemented from elastix::BaseComponent.

◆ AfterRegistration()

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

Reimplemented from elastix::BaseComponent.

◆ BeforeEachResolution()

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

Reimplemented from elastix::BaseComponent.

◆ BeforeRegistration()

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

◆ 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.

◆ operator=()

template<class TElastix >
void elastix::StandardGradientDescent< TElastix >::operator= ( const Self )
private

◆ SetCurrentPositionPublic()

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

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

Definition at line 134 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 ( void  )
override

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

Field Documentation

◆ 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 1667476801 for elastix by doxygen 1.9.4 elastix logo