Orfeo Toolbox  4.0
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
itk::MultipleValuedVnlCostFunctionAdaptor Class Reference

This class is an Adaptor that allows to pass itk::MultipleValuedCostFunctions to vnl_optimizers expecting a vnl_cost_function. More...

#include <itkMultipleValuedVnlCostFunctionAdaptor.h>

+ Inheritance diagram for itk::MultipleValuedVnlCostFunctionAdaptor:
+ Collaboration diagram for itk::MultipleValuedVnlCostFunctionAdaptor:

Public Types

typedef
MultipleValuedCostFunction::DerivativeType 
DerivativeType
 
typedef vnl_matrix< double > InternalDerivativeType
 
typedef vnl_vector< double > InternalMeasureType
 
typedef vnl_vector< double > InternalParametersType
 
typedef
MultipleValuedCostFunction::MeasureType 
MeasureType
 
typedef
MultipleValuedCostFunction::ParametersType 
ParametersType
 
typedef Array< double > ScalesType
 

Public Member Functions

 MultipleValuedVnlCostFunctionAdaptor (unsigned int spaceDimension, unsigned int numberOfValues)
 
unsigned long AddObserver (const EventObject &event, Command *) const
 
virtual void compute (const InternalParametersType &x, InternalMeasureType *f, InternalDerivativeType *g)
 
void ConvertExternalToInternalGradient (const DerivativeType &input, InternalDerivativeType &output)
 
void ConvertExternalToInternalMeasures (const MeasureType &input, InternalMeasureType &output)
 
virtual void f (const InternalParametersType &inparameters, InternalMeasureType &measures)
 
const ParametersTypeGetCachedCurrentParameters () const
 
const DerivativeTypeGetCachedDerivative () const
 
const MeasureTypeGetCachedValue () const
 
const MultipleValuedCostFunctionGetCostFunction (void) const
 
bool GetUseGradient () const
 
virtual void gradf (const InternalParametersType &inparameters, InternalDerivativeType &gradient)
 
void SetCostFunction (MultipleValuedCostFunction *costFunction)
 
void SetScales (const ScalesType &scales)
 
void SetUseGradient (bool)
 
void UseGradientOff ()
 
void UseGradientOn ()
 

Protected Member Functions

void ReportIteration (const EventObject &event) const
 

Private Member Functions

virtual const ScalesTypeGetInverseScales ()
 

Private Attributes

ParametersType m_CachedCurrentParameters
 
DerivativeType m_CachedDerivative
 
MeasureType m_CachedValue
 
MultipleValuedCostFunction::Pointer m_CostFunction
 
ScalesType m_InverseScales
 
Object::Pointer m_Reporter
 
bool m_ScalesInitialized
 

Detailed Description

This class is an Adaptor that allows to pass itk::MultipleValuedCostFunctions to vnl_optimizers expecting a vnl_cost_function.

This class returns a single valued.

Definition at line 36 of file itkMultipleValuedVnlCostFunctionAdaptor.h.

Member Typedef Documentation

Derivatives of the MultipleValuedCostFunction

Definition at line 57 of file itkMultipleValuedVnlCostFunctionAdaptor.h.

InternalGradientType typedef.

Definition at line 48 of file itkMultipleValuedVnlCostFunctionAdaptor.h.

InternalMeasureType typedef.

Definition at line 45 of file itkMultipleValuedVnlCostFunctionAdaptor.h.

InternalParametersType typedef.

Definition at line 42 of file itkMultipleValuedVnlCostFunctionAdaptor.h.

MeasureType of the MultipleValuedCostFunction

Definition at line 51 of file itkMultipleValuedVnlCostFunctionAdaptor.h.

Parameters of the MultipleValuedCostFunction

Definition at line 54 of file itkMultipleValuedVnlCostFunctionAdaptor.h.

Scales typedef

Definition at line 60 of file itkMultipleValuedVnlCostFunctionAdaptor.h.

Constructor & Destructor Documentation

itk::MultipleValuedVnlCostFunctionAdaptor::MultipleValuedVnlCostFunctionAdaptor ( unsigned int  spaceDimension,
unsigned int  numberOfValues 
)

Constructor with size

Constructor.

Definition at line 24 of file itkMultipleValuedVnlCostFunctionAdaptor.cxx.

References itk::Object::New().

Member Function Documentation

unsigned long itk::MultipleValuedVnlCostFunctionAdaptor::AddObserver ( const EventObject event,
Command command 
) const

This AddObserver method allows to simulate that this class derives from an itkObject for the purpose of reporting iteration events. The goal of this method is to allow ITK-vnl optimizer adaptors to get iteration events despite the fact that VNL does not provide callbacks.

Connects a Command/Observer to the internal reporter class. This is useful for reporting iteration event to potential observers.

Definition at line 232 of file itkMultipleValuedVnlCostFunctionAdaptor.cxx.

void itk::MultipleValuedVnlCostFunctionAdaptor::compute ( const InternalParametersType x,
InternalMeasureType ff,
InternalDerivativeType g 
)
virtual

Delegate computation of value and gradient to the costFunction.

Delegate computation of value and gradient to the costfunction.

Definition at line 127 of file itkMultipleValuedVnlCostFunctionAdaptor.cxx.

References itk::Array< TValueType >::SetData().

void itk::MultipleValuedVnlCostFunctionAdaptor::ConvertExternalToInternalGradient ( const DerivativeType input,
InternalDerivativeType output 
)

Convert external derviative measures into internal type

Definition at line 166 of file itkMultipleValuedVnlCostFunctionAdaptor.cxx.

void itk::MultipleValuedVnlCostFunctionAdaptor::ConvertExternalToInternalMeasures ( const MeasureType input,
InternalMeasureType output 
)

Convert external measures into internal type

Convert external Measures into internal type

Definition at line 190 of file itkMultipleValuedVnlCostFunctionAdaptor.cxx.

void itk::MultipleValuedVnlCostFunctionAdaptor::f ( const InternalParametersType inparameters,
InternalMeasureType measures 
)
virtual
const MultipleValuedVnlCostFunctionAdaptor::ParametersType & itk::MultipleValuedVnlCostFunctionAdaptor::GetCachedCurrentParameters ( ) const

Return the cached value of the parameters used for computing the function

Definition at line 257 of file itkMultipleValuedVnlCostFunctionAdaptor.cxx.

Referenced by itk::MultipleValuedNonLinearVnlOptimizer::IterationReport().

const MultipleValuedVnlCostFunctionAdaptor::DerivativeType & itk::MultipleValuedVnlCostFunctionAdaptor::GetCachedDerivative ( ) const

Return the cached value of the cost function derivative

Definition at line 248 of file itkMultipleValuedVnlCostFunctionAdaptor.cxx.

Referenced by itk::MultipleValuedNonLinearVnlOptimizer::IterationReport().

const MultipleValuedVnlCostFunctionAdaptor::MeasureType & itk::MultipleValuedVnlCostFunctionAdaptor::GetCachedValue ( ) const

Return the value of the last evaluation to the value of the cost function. Note that this method DOES NOT triggers a computation of the function or the derivatives, it only returns previous values. Therefore the values here are only valid after you invoke the f() or gradf() methods.

Return the cached value of the cost function

Definition at line 240 of file itkMultipleValuedVnlCostFunctionAdaptor.cxx.

Referenced by itk::MultipleValuedNonLinearVnlOptimizer::IterationReport().

const MultipleValuedCostFunction* itk::MultipleValuedVnlCostFunctionAdaptor::GetCostFunction ( void  ) const
inline

Get the CostFunction deriving from MultipleValuedCostFunction

Definition at line 71 of file itkMultipleValuedVnlCostFunctionAdaptor.h.

References m_CostFunction.

virtual const ScalesType& itk::MultipleValuedVnlCostFunctionAdaptor::GetInverseScales ( )
privatevirtual

Get current parameters scaling.

bool itk::MultipleValuedVnlCostFunctionAdaptor::GetUseGradient ( ) const

Return true if the cost function will provide a Gradient computation

Definition at line 213 of file itkMultipleValuedVnlCostFunctionAdaptor.cxx.

void itk::MultipleValuedVnlCostFunctionAdaptor::gradf ( const InternalParametersType inparameters,
InternalDerivativeType gradient 
)
virtual

Delegate computation of the gradient to the costFunction.

Delegate computation of the gradient to the costfunction.

Definition at line 94 of file itkMultipleValuedVnlCostFunctionAdaptor.cxx.

References itk::Array< TValueType >::SetData(), itk::ExceptionObject::SetDescription(), and itk::ExceptionObject::SetLocation().

void itk::MultipleValuedVnlCostFunctionAdaptor::ReportIteration ( const EventObject event) const
protected

This method is intended to be called by the derived classes in order to notify of an iteration event to any Command/Observers

This method reports iterations events. It is intended to help monitoring the progress of the optimization process.

Definition at line 223 of file itkMultipleValuedVnlCostFunctionAdaptor.cxx.

void itk::MultipleValuedVnlCostFunctionAdaptor::SetCostFunction ( MultipleValuedCostFunction costFunction)
inline

Set the CostFunction deriving from MultipleValuedCostFunction

Definition at line 67 of file itkMultipleValuedVnlCostFunctionAdaptor.h.

References m_CostFunction.

void itk::MultipleValuedVnlCostFunctionAdaptor::SetScales ( const ScalesType scales)

Set current parameters scaling.

Definition at line 35 of file itkMultipleValuedVnlCostFunctionAdaptor.cxx.

References itk::Array< TValueType >::GetSize().

void itk::MultipleValuedVnlCostFunctionAdaptor::SetUseGradient ( bool  useGradient)

Define if the Cost function should provide a customized Gradient computation or the gradient can be computed internally using a default approach

Define if the cost function will provide a Gradient computation

Definition at line 204 of file itkMultipleValuedVnlCostFunctionAdaptor.cxx.

Referenced by UseGradientOff(), and UseGradientOn().

void itk::MultipleValuedVnlCostFunctionAdaptor::UseGradientOff ( )
inline

Definition at line 103 of file itkMultipleValuedVnlCostFunctionAdaptor.h.

References SetUseGradient().

void itk::MultipleValuedVnlCostFunctionAdaptor::UseGradientOn ( )
inline

Definition at line 102 of file itkMultipleValuedVnlCostFunctionAdaptor.h.

References SetUseGradient().

Member Data Documentation

ParametersType itk::MultipleValuedVnlCostFunctionAdaptor::m_CachedCurrentParameters
mutableprivate

Definition at line 144 of file itkMultipleValuedVnlCostFunctionAdaptor.h.

DerivativeType itk::MultipleValuedVnlCostFunctionAdaptor::m_CachedDerivative
mutableprivate

Definition at line 143 of file itkMultipleValuedVnlCostFunctionAdaptor.h.

MeasureType itk::MultipleValuedVnlCostFunctionAdaptor::m_CachedValue
mutableprivate

Definition at line 142 of file itkMultipleValuedVnlCostFunctionAdaptor.h.

MultipleValuedCostFunction::Pointer itk::MultipleValuedVnlCostFunctionAdaptor::m_CostFunction
private

Definition at line 134 of file itkMultipleValuedVnlCostFunctionAdaptor.h.

Referenced by GetCostFunction(), and SetCostFunction().

ScalesType itk::MultipleValuedVnlCostFunctionAdaptor::m_InverseScales
private

Definition at line 139 of file itkMultipleValuedVnlCostFunctionAdaptor.h.

Object::Pointer itk::MultipleValuedVnlCostFunctionAdaptor::m_Reporter
private

Definition at line 140 of file itkMultipleValuedVnlCostFunctionAdaptor.h.

bool itk::MultipleValuedVnlCostFunctionAdaptor::m_ScalesInitialized
private

Definition at line 138 of file itkMultipleValuedVnlCostFunctionAdaptor.h.


The documentation for this class was generated from the following files:

Generated at Sat Mar 8 2014 17:28:28 for Orfeo Toolbox with doxygen 1.8.3.1