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
elastix::ConjugateGradientFRPR< TElastix > Class Template Reference

#include <elxConjugateGradientFRPR.h>

Detailed Description

template<class TElastix>
class elastix::ConjugateGradientFRPR< TElastix >

The ConjugateGradientFRPR class.

This component is based on the itkFRPROptimizer. This is a Fletcher-Reeves conjugate gradient optimizer, in combination with an exact (dBrent) line search, based on the description in Numerical Recipes in C++

This optimizer support the NewSamplesEveryIteration option. It requests new samples upon every derivative evaluation, but actually this makes no sense for a conjugate gradient optimizer. So, think twice before using it.

Note
It prints out no stop conditions, since the itk superclass does not generate them.
It considers line search iterations as elastix iterations.
Parameters:

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

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

MaximumNumberOfLineSearchIterations: The maximum number of iterations in each resolution.
example: (MaximumNumberOfIterations 10 10 5)
Default value: 10.

StepLength: Set the length of the initial step tried by the line seach, used to bracket the minimum.
example: (StepLength 2.0 1.0 0.5)
Default value: 1.0.

ValueTolerance: Convergence is declared if:

\[ 2.0 * | f_2 - f_1 | \le ValueTolerance * ( | f_1 | + | f_2 | ) \]

example: (ValueTolerance 0.001 0.00001 0.000001)
Default value: 0.00001.

LineSearchStepTolerance: Convergence of the line search is declared if:

\[ | x - x_m | \le tol * |x| - ( b - a ) / 2, \]

where:
$x$ = current mininum of the gain
$a, b$ = current brackets around the minimum
$x_m = (a+b)/2 $
example: (LineSearchStepTolerance 0.001 0.00001 0.000001)
Default value: 0.00001.

Definition at line 74 of file elxConjugateGradientFRPR.h.

Inheritance diagram for elastix::ConjugateGradientFRPR< TElastix >:
Inheritance graph
[legend]

Public Types

typedef Superclass2::ConfigurationPointer ConfigurationPointer
 
typedef Superclass2::ConfigurationType ConfigurationType
 
typedef itk::SmartPointer< const SelfConstPointer
 
typedef Superclass1::CostFunctionPointer CostFunctionPointer
 
typedef Superclass1::CostFunctionType CostFunctionType
 
typedef SingleValuedNonLinearOptimizer::DerivativeType DerivativeType
 
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 ConjugateGradientFRPR Self
 
typedef itk::FRPROptimizer Superclass1
 
typedef OptimizerBase< TElastix > Superclass2
 
- 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 ElastixType::ConfigurationPointer ConfigurationPointer
 
typedef ElastixType::ConfigurationType ConfigurationType
 
typedef ElastixType::Pointer ElastixPointer
 
typedef TElastix ElastixType
 
typedef RegistrationTypeRegistrationPointer
 
typedef ElastixType::RegistrationBaseType RegistrationType
 
typedef BaseComponentSE Self
 
typedef BaseComponent Superclass
 

Public Member Functions

virtual void AfterEachIteration (void)
 
virtual void AfterEachResolution (void)
 
virtual void AfterRegistration (void)
 
virtual void BeforeEachResolution (void)
 
virtual void BeforeRegistration (void)
 
 elxClassNameMacro ("ConjugateGradientFRPR")
 
virtual const char * GetClassName () const
 
virtual const doubleGetCurrentDerivativeMagnitude ()
 
virtual const doubleGetCurrentSearchDirectionMagnitude ()
 
virtual const doubleGetCurrentStepLength ()
 
virtual bool GetLineBracketing () const
 
virtual bool GetLineOptimizing () const
 
virtual void SetInitialPosition (const ParametersType &param)
 
- Public Member Functions inherited from elastix::OptimizerBase< TElastix >
virtual void AfterRegistrationBase (void)
 
virtual void BeforeEachResolutionBase ()
 
virtual ITKBaseTypeGetAsITKBaseType (void)
 
virtual const ITKBaseTypeGetAsITKBaseType (void) 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 >
virtual ConfigurationTypeGetConfiguration (void) const
 
virtual ElastixTypeGetElastix (void) const
 
virtual RegistrationPointer GetRegistration (void) const
 
virtual void SetConfiguration (ConfigurationType *_arg)
 
virtual void SetElastix (ElastixType *_arg)
 
- Public Member Functions inherited from elastix::BaseComponent
virtual void AfterEachIterationBase (void)
 
virtual void AfterEachResolutionBase (void)
 
virtual int BeforeAll (void)
 
virtual int BeforeAllBase (void)
 
virtual void BeforeRegistrationBase (void)
 
std::string ConvertSecondsToDHMS (const double totalSeconds, const unsigned int precision) const
 
virtual const char * elxGetClassName (void) const
 
virtual const char * GetComponentLabel (void) const
 
virtual void SetComponentLabel (const char *label, unsigned int idx)
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

virtual void BracketedLineOptimize (double ax, double bx, double cx, double fa, double fb, double fc, double *extX, double *extVal)
 
 ConjugateGradientFRPR ()
 
virtual void GetValueAndDerivative (ParametersType p, double *val, ParametersType *xi)
 
virtual void LineBracket (double *ax, double *bx, double *cx, double *fa, double *fb, double *fc)
 
virtual void LineOptimize (ParametersType *p, ParametersType xi, double *val)
 
virtual void SetLineBracketing (bool _arg)
 
virtual void SetLineOptimizing (bool _arg)
 
virtual ~ConjugateGradientFRPR ()
 
- Protected Member Functions inherited from elastix::OptimizerBase< TElastix >
virtual bool GetNewSamplesEveryIteration (void) const
 
 OptimizerBase ()
 
virtual void SelectNewSamples (void)
 
virtual ~OptimizerBase ()
 
- Protected Member Functions inherited from elastix::BaseComponentSE< TElastix >
 BaseComponentSE ()
 
virtual ~BaseComponentSE ()
 
- Protected Member Functions inherited from elastix::BaseComponent
 BaseComponent ()
 
virtual ~BaseComponent ()
 

Protected Attributes

double m_CurrentDerivativeMagnitude
 
double m_CurrentSearchDirectionMagnitude
 
double m_CurrentStepLength
 
- Protected Attributes inherited from elastix::BaseComponentSE< TElastix >
ConfigurationPointer m_Configuration
 
ElastixPointer m_Elastix
 
RegistrationPointer m_Registration
 

Private Member Functions

 ConjugateGradientFRPR (const Self &)
 
const char * DeterminePhase (void) const
 
void operator= (const Self &)
 

Private Attributes

bool m_LineBracketing
 
bool m_LineOptimizing
 

Member Typedef Documentation

Definition at line 110 of file elxConjugateGradientFRPR.h.

Definition at line 109 of file elxConjugateGradientFRPR.h.

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

Definition at line 87 of file elxConjugateGradientFRPR.h.

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

Definition at line 100 of file elxConjugateGradientFRPR.h.

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

Typedef's inherited from Superclass1.

Definition at line 99 of file elxConjugateGradientFRPR.h.

template<class TElastix >
typedef SingleValuedNonLinearOptimizer::DerivativeType elastix::ConjugateGradientFRPR< TElastix >::DerivativeType

Definition at line 104 of file elxConjugateGradientFRPR.h.

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

Definition at line 108 of file elxConjugateGradientFRPR.h.

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

Typedef's inherited from Elastix.

Definition at line 107 of file elxConjugateGradientFRPR.h.

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

Definition at line 113 of file elxConjugateGradientFRPR.h.

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

Definition at line 102 of file elxConjugateGradientFRPR.h.

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

Definition at line 86 of file elxConjugateGradientFRPR.h.

Definition at line 112 of file elxConjugateGradientFRPR.h.

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

Definition at line 111 of file elxConjugateGradientFRPR.h.

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

Standard ITK.

Definition at line 83 of file elxConjugateGradientFRPR.h.

template<class TElastix >
typedef itk::FRPROptimizer elastix::ConjugateGradientFRPR< TElastix >::Superclass1

Definition at line 84 of file elxConjugateGradientFRPR.h.

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

Definition at line 85 of file elxConjugateGradientFRPR.h.

Constructor & Destructor Documentation

template<class TElastix >
elastix::ConjugateGradientFRPR< TElastix >::ConjugateGradientFRPR ( )
protected
template<class TElastix >
virtual elastix::ConjugateGradientFRPR< TElastix >::~ConjugateGradientFRPR ( )
inlineprotectedvirtual

Definition at line 147 of file elxConjugateGradientFRPR.h.

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

Member Function Documentation

template<class TElastix >
virtual void elastix::ConjugateGradientFRPR< TElastix >::AfterEachIteration ( void  )
virtual

Reimplemented from elastix::BaseComponent.

template<class TElastix >
virtual void elastix::ConjugateGradientFRPR< TElastix >::AfterEachResolution ( void  )
virtual

Reimplemented from elastix::BaseComponent.

template<class TElastix >
virtual void elastix::ConjugateGradientFRPR< TElastix >::AfterRegistration ( void  )
virtual

Reimplemented from elastix::BaseComponent.

template<class TElastix >
virtual void elastix::ConjugateGradientFRPR< TElastix >::BeforeEachResolution ( void  )
virtual

Reimplemented from elastix::BaseComponent.

template<class TElastix >
virtual void elastix::ConjugateGradientFRPR< TElastix >::BeforeRegistration ( void  )
virtual

Methods to set parameters and print output at different stages in the registration process.

Reimplemented from elastix::BaseComponent.

template<class TElastix >
virtual void elastix::ConjugateGradientFRPR< TElastix >::BracketedLineOptimize ( double  ax,
double  bx,
double  cx,
double  fa,
double  fb,
double  fc,
double extX,
double extVal 
)
protectedvirtual

Given a bracketing triple of points and their function values, returns a bounded extreme. These values are in parameter space, along the current line and wrt the current origin set via SetLine. Optimization terminates based on MaximumIteration, StepTolerance, or ValueTolerance. Implemented as Brent line optimers from NRC.

This implementation sets the LineOptimizing flag to 'true', calls the the superclass's implementation, stores extX as the current step length, and sets the LineOptimizing flag to 'false' again.

template<class TElastix >
const char* elastix::ConjugateGradientFRPR< TElastix >::DeterminePhase ( void  ) const
private
template<class TElastix >
elastix::ConjugateGradientFRPR< TElastix >::elxClassNameMacro ( "ConjugateGradientFRPR< TElastix >"  )

Name of this class.

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

Run-time type information (and related methods).

Reimplemented from elastix::OptimizerBase< TElastix >.

template<class TElastix >
virtual const double& elastix::ConjugateGradientFRPR< TElastix >::GetCurrentDerivativeMagnitude ( )
virtual

Return the magnitude of the cached derivative

template<class TElastix >
virtual const double& elastix::ConjugateGradientFRPR< TElastix >::GetCurrentSearchDirectionMagnitude ( )
virtual

Get the magnitude of the line search direction

template<class TElastix >
virtual const double& elastix::ConjugateGradientFRPR< TElastix >::GetCurrentStepLength ( )
virtual

Get the current gain

template<class TElastix >
virtual bool elastix::ConjugateGradientFRPR< TElastix >::GetLineBracketing ( ) const
virtual
template<class TElastix >
virtual bool elastix::ConjugateGradientFRPR< TElastix >::GetLineOptimizing ( ) const
virtual

Check if the optimizer is currently Bracketing the minimum, or is optimizing along a line

template<class TElastix >
virtual void elastix::ConjugateGradientFRPR< TElastix >::GetValueAndDerivative ( ParametersType  p,
double val,
ParametersType xi 
)
protectedvirtual

Get the value of the n-dimensional cost function at this scalar step distance along the current line direction from the current line origin. Line origin and distances are set via SetLine.

This implementation calls the Superclass' implementation and caches the computed derivative's magnitude. Besides, it invokes the SelectNewSamples method.

template<class TElastix >
virtual void elastix::ConjugateGradientFRPR< TElastix >::LineBracket ( double ax,
double bx,
double cx,
double fa,
double fb,
double fc 
)
protectedvirtual

The LineBracket routine from NRC. Uses current origin and line direction (from SetLine) to find a triple of points (ax, bx, cx) that bracket the extreme "near" the origin. Search first considers the point StepLength distance from ax. IMPORTANT: The value of ax and the value of the function at ax (i.e., fa), must both be provided to this function.

This implementation sets the LineBracketing flag to 'true', calls the superclass' implementation, stores bx as the current step length, invokes an iteration event, and sets the LineBracketing flag to 'false'

template<class TElastix >
virtual void elastix::ConjugateGradientFRPR< TElastix >::LineOptimize ( ParametersType p,
ParametersType  xi,
double val 
)
protectedvirtual

store the line search direction's (xi) magnitude and call the superclass' implementation.

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

Method for creation through the object factory.

template<class TElastix >
void elastix::ConjugateGradientFRPR< TElastix >::operator= ( const Self )
private
template<class TElastix >
virtual void elastix::ConjugateGradientFRPR< TElastix >::SetInitialPosition ( const ParametersType param)
virtual

Override the SetInitialPosition.

template<class TElastix >
virtual void elastix::ConjugateGradientFRPR< TElastix >::SetLineBracketing ( bool  _arg)
protectedvirtual
template<class TElastix >
virtual void elastix::ConjugateGradientFRPR< TElastix >::SetLineOptimizing ( bool  _arg)
protectedvirtual

Set if the optimizer is currently bracketing the minimum, or is optimizing along a line

Field Documentation

template<class TElastix >
double elastix::ConjugateGradientFRPR< TElastix >::m_CurrentDerivativeMagnitude
protected

To store the latest computed derivative's magnitude

Definition at line 150 of file elxConjugateGradientFRPR.h.

template<class TElastix >
double elastix::ConjugateGradientFRPR< TElastix >::m_CurrentSearchDirectionMagnitude
protected

Variable to store the line search direction magnitude

Definition at line 153 of file elxConjugateGradientFRPR.h.

template<class TElastix >
double elastix::ConjugateGradientFRPR< TElastix >::m_CurrentStepLength
protected

the current gain

Definition at line 156 of file elxConjugateGradientFRPR.h.

template<class TElastix >
bool elastix::ConjugateGradientFRPR< TElastix >::m_LineBracketing
private

Definition at line 212 of file elxConjugateGradientFRPR.h.

template<class TElastix >
bool elastix::ConjugateGradientFRPR< TElastix >::m_LineOptimizing
private

Definition at line 211 of file elxConjugateGradientFRPR.h.



Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo