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

#include <elxFiniteDifferenceGradientDescent.h>

Detailed Description

template<class TElastix>
class elastix::FiniteDifferenceGradientDescent< TElastix >

An optimizer based on the itk::FiniteDifferenceGradientDescentOptimizer.

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

Watch out for this optimizer; it may be very slow....

The parameters used in this class are:

Parameters

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

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

SP_a: The gain $a(k)$ at each iteration $k$ is defined by
$\quad 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
$\quad 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
$\quad 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.

SP_c: The perturbation step size $c(k)$ at each iteration $k$ is defined by
$\quad c(k) =  SP\_c / ( k + 1)^{SP\_gamma}$.
SP_c can be defined for each resolution.
example: (SP_c 2.0 1.0 1.0)
The default value is 1.0.

SP_gamma: The perturbation step size $c(k)$ at each iteration $k$ is defined by
$\quad c(k) =  SP\_c / ( k + 1)^{SP\_gamma}$.
SP_gamma can be defined for each resolution.
example: (SP_gamma 0.101 0.101 0.101)
The default/recommended value is 0.101.

ShowMetricValues: Defines whether to compute/show the metric value in each iteration.
This flag can NOT be defined for each resolution.
example: (ShowMetricValues "true" )
Default value: "false". Note that turning this flag on increases computation time.

See also
FiniteDifferenceGradientDescentOptimizer

Definition at line 80 of file elxFiniteDifferenceGradientDescent.h.

Inheritance diagram for elastix::FiniteDifferenceGradientDescent< TElastix >:

Public Types

using ConstPointer = itk::SmartPointer<const Self>
 
using ITKBaseType = typename Superclass2::ITKBaseType
 
using Pointer = itk::SmartPointer<Self>
 
using Self = FiniteDifferenceGradientDescent
 
enum  StopConditionType
 
using Superclass1 = FiniteDifferenceGradientDescentOptimizer
 
using Superclass2 = OptimizerBase<TElastix>
 
- Public Types inherited from itk::FiniteDifferenceGradientDescentOptimizer
using ConstPointer = SmartPointer<const Self>
 
using Pointer = SmartPointer<Self>
 
using Self = FiniteDifferenceGradientDescentOptimizer
 
enum  StopConditionType { MaximumNumberOfIterations , MetricError }
 
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 ("FiniteDifferenceGradientDescent")
 
virtual const char * GetClassName () const
 
 ITK_DISALLOW_COPY_AND_MOVE (FiniteDifferenceGradientDescent)
 
void StartOptimization () override
 
- Public Member Functions inherited from itk::FiniteDifferenceGradientDescentOptimizer
virtual void AdvanceOneStep ()
 
virtual void ComputeCurrentValueOff ()
 
virtual void ComputeCurrentValueOn ()
 
virtual bool GetComputeCurrentValue () const
 
virtual unsigned long GetCurrentIteration () const
 
virtual double GetGradientMagnitude () const
 
virtual double GetLearningRate () const
 
virtual unsigned long GetNumberOfIterations () const
 
virtual double GetParam_A () const
 
virtual double GetParam_a () const
 
virtual double GetParam_alpha () const
 
virtual double GetParam_c () const
 
virtual double GetParam_gamma () const
 
virtual StopConditionType GetStopCondition () const
 
virtual double GetValue () const
 
 ITK_DISALLOW_COPY_AND_MOVE (FiniteDifferenceGradientDescentOptimizer)
 
void ResumeOptimization ()
 
virtual void SetComputeCurrentValue (bool _arg)
 
virtual void SetNumberOfIterations (unsigned long _arg)
 
virtual void SetParam_A (double _arg)
 
virtual void SetParam_a (double _arg)
 
virtual void SetParam_alpha (double _arg)
 
virtual void SetParam_c (double _arg)
 
virtual void SetParam_gamma (double _arg)
 
void StartOptimization () override
 
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::FiniteDifferenceGradientDescentOptimizer
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

 FiniteDifferenceGradientDescent ()
 
 ~FiniteDifferenceGradientDescent () override=default
 
- Protected Member Functions inherited from itk::FiniteDifferenceGradientDescentOptimizer
virtual double Compute_a (unsigned long k) const
 
virtual double Compute_c (unsigned long k) const
 
 FiniteDifferenceGradientDescentOptimizer ()
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
 ~FiniteDifferenceGradientDescentOptimizer () 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

bool m_ShowMetricValues
 
- Protected Attributes inherited from itk::FiniteDifferenceGradientDescentOptimizer
bool m_ComputeCurrentValue { false }
 
DerivativeType m_Gradient {}
 
double m_GradientMagnitude { 0.0 }
 
double m_LearningRate { 0.0 }
 
- 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
 

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)
 

Member Typedef Documentation

◆ ConstPointer

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

Definition at line 92 of file elxFiniteDifferenceGradientDescent.h.

◆ ITKBaseType

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

Definition at line 114 of file elxFiniteDifferenceGradientDescent.h.

◆ Pointer

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

Definition at line 91 of file elxFiniteDifferenceGradientDescent.h.

◆ Self

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

Standard ITK.

Definition at line 88 of file elxFiniteDifferenceGradientDescent.h.

◆ Superclass1

template<class TElastix >
using elastix::FiniteDifferenceGradientDescent< TElastix >::Superclass1 = FiniteDifferenceGradientDescentOptimizer

Definition at line 89 of file elxFiniteDifferenceGradientDescent.h.

◆ Superclass2

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

Definition at line 90 of file elxFiniteDifferenceGradientDescent.h.

Member Enumeration Documentation

◆ StopConditionType

Codes of stopping conditions

Definition at line 73 of file itkFiniteDifferenceGradientDescentOptimizer.h.

Constructor & Destructor Documentation

◆ FiniteDifferenceGradientDescent()

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

◆ ~FiniteDifferenceGradientDescent()

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

Member Function Documentation

◆ AfterEachIteration()

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

Reimplemented from elastix::BaseComponent.

◆ AfterEachResolution()

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

Reimplemented from elastix::BaseComponent.

◆ AfterRegistration()

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

Reimplemented from elastix::BaseComponent.

◆ BeforeEachResolution()

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

Reimplemented from elastix::BaseComponent.

◆ BeforeRegistration()

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

Methods that take care of setting parameters and printing progress information.

Reimplemented from elastix::BaseComponent.

◆ elxClassNameMacro()

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

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

◆ GetClassName()

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

Run-time type information (and related methods).

Reimplemented from itk::FiniteDifferenceGradientDescentOptimizer.

◆ ITK_DISALLOW_COPY_AND_MOVE()

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

◆ New()

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

Method for creation through the object factory.

◆ StartOptimization()

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

Definition at line 147 of file elxFiniteDifferenceGradientDescent.h.

◆ m_ShowMetricValues

template<class TElastix >
bool elastix::FiniteDifferenceGradientDescent< TElastix >::m_ShowMetricValues
protected

Definition at line 144 of file elxFiniteDifferenceGradientDescent.h.



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