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 | Protected Attributes | Private Member Functions | Private Attributes
itk::ScaledSingleValuedNonLinearOptimizer Class Reference

#include <itkScaledSingleValuedNonLinearOptimizer.h>

Detailed Description

Optimizers that inherit from this class optimize a scaled cost function $F(y)$ instead of the original function $f(x)$:

\[ y = x \cdot s \]

\[ F(y) = f(y/s) \]

where $y$ are the scaled parameters, $x$ the original parameters and $s$ the scales.

During optimization the inheriting classes should update the ScaledCurrentPosition ( $y$) instead of the CurrentPosition ( $y/s$).

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

Typically, in StartOptimization() the following line should be present:
This makes sure that the initial position $y_0 = x_0 \cdot s$, where $x_0$ is the initial (unscaled) position entered by the user.

Note that:

Definition at line 62 of file itkScaledSingleValuedNonLinearOptimizer.h.

Inheritance diagram for itk::ScaledSingleValuedNonLinearOptimizer:
Inheritance graph

Public Types

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

virtual const char * GetClassName () const
virtual const ParametersTypeGetCurrentPosition (void) const
virtual bool GetMaximize () const
virtual const ScaledCostFunctionTypeGetScaledCostFunction ()
virtual const ParametersTypeGetScaledCurrentPosition ()
bool GetUseScales (void) const
virtual void InitializeScales (void)
virtual void MaximizeOff ()
virtual void MaximizeOn ()
virtual void SetCostFunction (CostFunctionType *costFunction)
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
 ScaledSingleValuedNonLinearOptimizer ()
virtual void SetCurrentPosition (const ParametersType &param)
virtual void SetScaledCurrentPosition (const ParametersType &parameters)
virtual ~ScaledSingleValuedNonLinearOptimizer ()

Protected Attributes

ScaledCostFunctionPointer m_ScaledCostFunction
ParametersType m_ScaledCurrentPosition

Private Member Functions

void operator= (const Self &)
 ScaledSingleValuedNonLinearOptimizer (const Self &)

Private Attributes

bool m_Maximize
ParametersType m_UnscaledCurrentPosition

Member Typedef Documentation

Definition at line 71 of file itkScaledSingleValuedNonLinearOptimizer.h.

Definition at line 84 of file itkScaledSingleValuedNonLinearOptimizer.h.

Definition at line 83 of file itkScaledSingleValuedNonLinearOptimizer.h.

Typedefs inherited from the superclass.

Definition at line 78 of file itkScaledSingleValuedNonLinearOptimizer.h.

Definition at line 82 of file itkScaledSingleValuedNonLinearOptimizer.h.

Definition at line 70 of file itkScaledSingleValuedNonLinearOptimizer.h.

Definition at line 88 of file itkScaledSingleValuedNonLinearOptimizer.h.

Definition at line 87 of file itkScaledSingleValuedNonLinearOptimizer.h.

typedef NonLinearOptimizer::ScalesType itk::ScaledSingleValuedNonLinearOptimizer::ScalesType

Definition at line 86 of file itkScaledSingleValuedNonLinearOptimizer.h.

Standard ITK-stuff.

Definition at line 68 of file itkScaledSingleValuedNonLinearOptimizer.h.

Definition at line 69 of file itkScaledSingleValuedNonLinearOptimizer.h.

Constructor & Destructor Documentation

itk::ScaledSingleValuedNonLinearOptimizer::ScaledSingleValuedNonLinearOptimizer ( )

The constructor.

virtual itk::ScaledSingleValuedNonLinearOptimizer::~ScaledSingleValuedNonLinearOptimizer ( )

The destructor.

Definition at line 134 of file itkScaledSingleValuedNonLinearOptimizer.h.

itk::ScaledSingleValuedNonLinearOptimizer::ScaledSingleValuedNonLinearOptimizer ( const Self )

The private constructor.

Member Function Documentation

virtual const char* itk::ScaledSingleValuedNonLinearOptimizer::GetClassName ( ) const
virtual const ParametersType& itk::ScaledSingleValuedNonLinearOptimizer::GetCurrentPosition ( void  ) const

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

virtual bool itk::ScaledSingleValuedNonLinearOptimizer::GetMaximize ( ) const
virtual const ScaledCostFunctionType* itk::ScaledSingleValuedNonLinearOptimizer::GetScaledCostFunction ( )

Get a pointer to the scaled cost function.

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

Get the current scaled position.

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

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

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

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

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

Same procedure as in GetValue and GetDerivative.

bool itk::ScaledSingleValuedNonLinearOptimizer::GetUseScales ( void  ) const
virtual void itk::ScaledSingleValuedNonLinearOptimizer::InitializeScales ( void  )

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.

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

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.

static Pointer itk::ScaledSingleValuedNonLinearOptimizer::New ( )

Method for creation through the object factory.

void itk::ScaledSingleValuedNonLinearOptimizer::operator= ( const Self )

The private copy constructor.

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


virtual void itk::ScaledSingleValuedNonLinearOptimizer::SetCostFunction ( CostFunctionType costFunction)

Setting: SetCostFunction.

virtual void itk::ScaledSingleValuedNonLinearOptimizer::SetCurrentPosition ( const ParametersType param)

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.

virtual void itk::ScaledSingleValuedNonLinearOptimizer::SetMaximize ( bool  _arg)
virtual void itk::ScaledSingleValuedNonLinearOptimizer::SetScaledCurrentPosition ( const ParametersType parameters)

Set m_ScaledCurrentPosition.

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

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

Field Documentation

bool itk::ScaledSingleValuedNonLinearOptimizer::m_Maximize

Definition at line 191 of file itkScaledSingleValuedNonLinearOptimizer.h.

ScaledCostFunctionPointer itk::ScaledSingleValuedNonLinearOptimizer::m_ScaledCostFunction

Definition at line 141 of file itkScaledSingleValuedNonLinearOptimizer.h.

ParametersType itk::ScaledSingleValuedNonLinearOptimizer::m_ScaledCurrentPosition

Member variables.

Definition at line 140 of file itkScaledSingleValuedNonLinearOptimizer.h.

ParametersType itk::ScaledSingleValuedNonLinearOptimizer::m_UnscaledCurrentPosition

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 04-09-2015 for elastix by doxygen elastix logo