Loading...
Searching...
No Matches
itk::ScaledSingleValuedNonLinearOptimizer Class Reference

`#include <itkScaledSingleValuedNonLinearOptimizer.h>`

## Detailed Description

Optimizers that inherit from this class optimize a scaled cost function instead of the original function :

where are the scaled parameters, the original parameters and the scales.

During optimization the inheriting classes should update the ScaledCurrentPosition ( ) instead of the CurrentPosition ( ).

When an optimizer needs the value at a (scaled) position , it should use the function this->GetScaledValue( ) instead of the GetValue method. Similar for the derivative.

Typically, in StartOptimization() the following line should be present:
this->SetCurrentPosition(this->GetInitialPosition);
This makes sure that the initial position , where is the initial (unscaled) position entered by the user.

Note that:

- GetScaledCurrentPosition returns the current .
- GetCurrentPosition returns the current . This array is only computed when asked for by the user.
- It is NOT necessary to set the CurrentPosition!! In fact, it is not possible anymore: the SetCurrentPosition(param) method is overrided and calls SetScaledCurrentPositon(param*scales).
- The ITK convention is to set the squared scales in the optimizer. So, if you want a scaling s, you must call SetScales( ) (where .* symbolises the element-wise product of with )

Definition at line 62 of file itkScaledSingleValuedNonLinearOptimizer.h.

Inheritance diagram for itk::ScaledSingleValuedNonLinearOptimizer:
[legend]

## Public Types

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 Member Functions

virtual const char * | GetClassName () const
const ParametersType & | GetCurrentPosition () const override
virtual bool | GetMaximize () const
virtual const ScaledCostFunctionType * | GetScaledCostFunction ()
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)

## Static Public Member Functions

static Pointer | New ()

## Protected Member Functions

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 Attributes

ScaledCostFunctionPointer | m_ScaledCostFunction {}
ParametersType | m_ScaledCurrentPosition {}

## Private Attributes

bool | m_Maximize {}
ParametersType | m_UnscaledCurrentPosition {}

## Member Typedef Documentation

## ConstPointer

using itk::ScaledSingleValuedNonLinearOptimizer::ConstPointer = SmartPointer<const Self>

Definition at line 71 of file itkScaledSingleValuedNonLinearOptimizer.h.

## Pointer

using itk::ScaledSingleValuedNonLinearOptimizer::Pointer = SmartPointer<Self>

Definition at line 70 of file itkScaledSingleValuedNonLinearOptimizer.h.

## ScaledCostFunctionPointer

using itk::ScaledSingleValuedNonLinearOptimizer::ScaledCostFunctionPointer = ScaledCostFunctionType::Pointer

Definition at line 87 of file itkScaledSingleValuedNonLinearOptimizer.h.

## ScaledCostFunctionType

using itk::ScaledSingleValuedNonLinearOptimizer::ScaledCostFunctionType = ScaledSingleValuedCostFunction

Definition at line 86 of file itkScaledSingleValuedNonLinearOptimizer.h.

## ScalesType

using itk::ScaledSingleValuedNonLinearOptimizer::ScalesType = NonLinearOptimizer::ScalesType

Definition at line 85 of file itkScaledSingleValuedNonLinearOptimizer.h.

## Self

using itk::ScaledSingleValuedNonLinearOptimizer::Self = ScaledSingleValuedNonLinearOptimizer

Standard ITK-stuff.

Definition at line 68 of file itkScaledSingleValuedNonLinearOptimizer.h.

## Superclass

using itk::ScaledSingleValuedNonLinearOptimizer::Superclass = SingleValuedNonLinearOptimizer

Definition at line 69 of file itkScaledSingleValuedNonLinearOptimizer.h.

## Constructor & Destructor Documentation

## ScaledSingleValuedNonLinearOptimizer()

itk::ScaledSingleValuedNonLinearOptimizer::ScaledSingleValuedNonLinearOptimizer | ( |  | ) |

protected

The constructor.

## ~ScaledSingleValuedNonLinearOptimizer()

itk::ScaledSingleValuedNonLinearOptimizer::~ScaledSingleValuedNonLinearOptimizer | ( |  | ) |

override protected default

The destructor.

## Member Function Documentation

## GetClassName()

virtual const char * itk::ScaledSingleValuedNonLinearOptimizer::GetClassName | ( |  | ) | const

virtual

Run-time type information (and related methods).

Reimplemented in elastix::AdaGrad< TElastix >, elastix::AdaptiveStochasticGradientDescent< TElastix >, elastix::AdaptiveStochasticLBFGS< TElastix >, elastix::AdaptiveStochasticVarianceReducedGradient< TElastix >, elastix::CMAEvolutionStrategy< TElastix >, elastix::ConjugateGradient< TElastix >, elastix::FiniteDifferenceGradientDescent< TElastix >, elastix::PreconditionedStochasticGradientDescent< TElastix >, elastix::QuasiNewtonLBFGS< TElastix >, elastix::StandardGradientDescent< TElastix >, itk::AdaptiveStepsizeOptimizer, itk::AdaptiveStochasticGradientDescentOptimizer, itk::AdaptiveStochasticLBFGSOptimizer, itk::AdaptiveStochasticVarianceReducedGradientOptimizer, itk::CMAEvolutionStrategyOptimizer, itk::ComputeDisplacementDistribution< TFixedImage, TTransform >, itk::ComputeDisplacementDistribution< FixedImageType, TransformType >, itk::ComputePreconditionerUsingDisplacementDistribution< TFixedImage, TTransform >, itk::ComputePreconditionerUsingDisplacementDistribution< FixedImageType, TransformType >, itk::FiniteDifferenceGradientDescentOptimizer, itk::GenericConjugateGradientOptimizer, itk::GradientDescentOptimizer2, itk::PreconditionedASGDOptimizer, itk::QuasiNewtonLBFGSOptimizer, itk::StandardGradientDescentOptimizer, itk::StandardStochasticGradientOptimizer, itk::StandardStochasticVarianceReducedGradientOptimizer, itk::StochasticGradientDescentOptimizer, and itk::StochasticVarianceReducedGradientDescentOptimizer.

## GetCurrentPosition()

const ParametersType & itk::ScaledSingleValuedNonLinearOptimizer::GetCurrentPosition | ( |  | ) | const

override

Get the current unscaled position: get the ScaledCurrentPosition and divide each element through its scale.

## GetMaximize()

virtual bool itk::ScaledSingleValuedNonLinearOptimizer::GetMaximize | ( |  | ) | const

virtual

## GetScaledCostFunction()

virtual const ScaledCostFunctionType * itk::ScaledSingleValuedNonLinearOptimizer::GetScaledCostFunction | ( |  | ) |

virtual

Get a pointer to the scaled cost function.

## GetScaledCurrentPosition()

virtual const ParametersType & itk::ScaledSingleValuedNonLinearOptimizer::GetScaledCurrentPosition | ( |  | ) |

virtual

Get the current scaled position.

## GetScaledDerivative()

virtual void itk::ScaledSingleValuedNonLinearOptimizer::GetScaledDerivative | ( | const ParametersType & | parameters,
|  | DerivativeType & | derivative ) const

protected virtual

Divide the (scaled) parameters by the scales, call the GetDerivative routine of the unscaled cost function and divide the resulting derivative by the scales.

## GetScaledValue()

virtual MeasureType itk::ScaledSingleValuedNonLinearOptimizer::GetScaledValue | ( | const ParametersType & | parameters | ) | const

protected virtual

Divide the (scaled) parameters by the scales and call the GetValue routine of the unscaled cost function.

## GetScaledValueAndDerivative()

virtual void itk::ScaledSingleValuedNonLinearOptimizer::GetScaledValueAndDerivative | ( | const ParametersType & | parameters,
|  | MeasureType & | value,
|  | DerivativeType & | derivative ) const

protected virtual

Same procedure as in GetValue and GetDerivative.

## GetUseScales()

bool itk::ScaledSingleValuedNonLinearOptimizer::GetUseScales | ( |  | ) | const

## InitializeScales()

virtual void itk::ScaledSingleValuedNonLinearOptimizer::InitializeScales | ( |  | ) |

virtual

Configure the scaled cost function. This function sets the current scales in the ScaledCostFunction. NB: it assumes that the scales entered by the user are the squared scales (following the ITK convention). Call this method in StartOptimization() and after entering new scales.

## ITK_DISALLOW_COPY_AND_MOVE()

itk::ScaledSingleValuedNonLinearOptimizer::ITK_DISALLOW_COPY_AND_MOVE | ( | ScaledSingleValuedNonLinearOptimizer |  | ) |

## MaximizeOff()

virtual void itk::ScaledSingleValuedNonLinearOptimizer::MaximizeOff | ( |  | ) |

virtual

## MaximizeOn()

virtual void itk::ScaledSingleValuedNonLinearOptimizer::MaximizeOn | ( |  | ) |

virtual

Setting: set to 'true' if you want to maximize the cost function. It forces the scaledCostFunction to negate the cost function value and its derivative.

## New()

Pointer itk::ScaledSingleValuedNonLinearOptimizer::New | ( |  | ) |

static

Method for creation through the object factory.

## PrintSelf()

void itk::ScaledSingleValuedNonLinearOptimizer::PrintSelf | ( | std::ostream & | os,
|  | Indent | indent ) const

override protected

PrintSelf.

## SetCostFunction()

void itk::ScaledSingleValuedNonLinearOptimizer::SetCostFunction | ( | CostFunctionType * | costFunction | ) |

override

Setting: SetCostFunction.

## SetCurrentPosition()

void itk::ScaledSingleValuedNonLinearOptimizer::SetCurrentPosition | ( | const ParametersType & | param | ) |

override protected

Set the scaled current position by entering the non-scaled parameters. The method multiplies param by the scales and calls SetScaledCurrentPosition.

Note: It is not possible (and needed) anymore to set m_CurrentPosition. Optimizers that inherit from this class should optimize the scaled parameters!

This method will probably only be used to convert the InitialPosition entered by the user.

## SetMaximize()

virtual void itk::ScaledSingleValuedNonLinearOptimizer::SetMaximize | ( | bool | _arg | ) |

virtual

## SetScaledCurrentPosition()

virtual void itk::ScaledSingleValuedNonLinearOptimizer::SetScaledCurrentPosition | ( | const ParametersType & | parameters | ) |

protected virtual

Set m_ScaledCurrentPosition.

## SetUseScales()

virtual void itk::ScaledSingleValuedNonLinearOptimizer::SetUseScales | ( | bool | arg | ) |

virtual

Setting: Turn on/off the use of scales. Set this flag to false when no scaling is desired.

## Field Documentation

## m_Maximize

bool itk::ScaledSingleValuedNonLinearOptimizer::m_Maximize {}

private

Definition at line 191 of file itkScaledSingleValuedNonLinearOptimizer.h.

## m_ScaledCostFunction

ScaledCostFunctionPointer itk::ScaledSingleValuedNonLinearOptimizer::m_ScaledCostFunction {}

protected

Definition at line 146 of file itkScaledSingleValuedNonLinearOptimizer.h.

## m_ScaledCurrentPosition

ParametersType itk::ScaledSingleValuedNonLinearOptimizer::m_ScaledCurrentPosition {}

protected

Member variables.

Definition at line 145 of file itkScaledSingleValuedNonLinearOptimizer.h.

## m_UnscaledCurrentPosition

ParametersType itk::ScaledSingleValuedNonLinearOptimizer::m_UnscaledCurrentPosition {}

mutable private

Variable to store the CurrentPosition, when the function GetCurrentPosition is called. This method needs a member variable, because the GetCurrentPosition return something by reference.

Definition at line 190 of file itkScaledSingleValuedNonLinearOptimizer.h.

Generated on 1768596610 for elastix by 1.15.0 |