FREE::SingleValuedVnlSOMetricAdaptor Class Reference

This class is an Adaptor that allows to pass. More...

#include <freSingleValuedVnlSOMetricAdaptor.h>

Inheritance diagram for FREE::SingleValuedVnlSOMetricAdaptor:

Inheritance graph
FREE::SVLimitedAxisVnlSOMetricAdaptor
[legend]

List of all members.

Public Types

typedef vnl_vector
< double > 
InternalParametersType
typedef double InternalMeasureType
typedef vnl_vector
< double > 
InternalDerivativeType
typedef
SetupOptimizationMetric::ParametersType 
ParametersType
typedef itk::Array
< double > 
DerivativeType
typedef
SetupOptimizationMetric::MeasureType 
MeasureType
typedef
SetupOptimizationMetric::DecomposedMeasureType 
DecomposedMeasureType
typedef itk::Array
< double > 
ScalesType
typedef itk::Array
< double > 
MetricScalesType

Public Member Functions

virtual const char * GetNameOfClass () const
 SingleValuedVnlSOMetricAdaptor (unsigned int spaceDimension)
void SetCostFunction (SetupOptimizationMetric *costFunction)
const
SetupOptimizationMetric
GetCostFunction (void) const
virtual
InternalMeasureType 
f (const InternalParametersType &inparameters)
virtual void gradf (const InternalParametersType &inparameters, InternalDerivativeType &gradient)
virtual void compute (const InternalParametersType &x, InternalMeasureType *f, InternalDerivativeType *g)
void ConvertExternalToInternalGradient (const DerivativeType &input, InternalDerivativeType &output) const
void SetScales (const ScalesType &scales)
void SetNegateCostFunction (bool value)
bool GetNegateCostFunction () const
void NegateCostFunctionOn ()
void NegateCostFunctionOff ()
unsigned long AddObserver (const itk::EventObject &event, itk::Command *command) const
const MeasureTypeGetCachedValue () const
const
DecomposedMeasureType
GetCachedDecomposedValue () const
const DerivativeTypeGetCachedDerivative () const
const ParametersTypeGetCachedCurrentParameters () const

Protected Member Functions

void ReportIteration (const itk::EventObject &event) const
virtual ParametersType ConvertInternalToParameter (const InternalParametersType &inparameters)
virtual
InternalParametersType 
ConvertParameterToInternal (const ParametersType &parameters)

Protected Attributes

SetupOptimizationMetric::Pointer m_CostFunction
bool m_ScalesInitialized
ScalesType m_Scales
bool m_NegateCostFunction
itk::Object::Pointer m_Reporter
MeasureType m_CachedValue
DecomposedMeasureType m_CachedDecomposedValue
DerivativeType m_CachedDerivative
ParametersType m_CachedCurrentParameters


Detailed Description

This class is an Adaptor that allows to pass.

FREE::SetupOptimizationMetrics to vnl_optimizers expecting a vnl_cost_function with one return value.

This class returns a single valued.

Definition at line 46 of file freSingleValuedVnlSOMetricAdaptor.h.


Member Typedef Documentation

typedef vnl_vector<double> FREE::SingleValuedVnlSOMetricAdaptor::InternalParametersType

InternalParametersType typedef.

Definition at line 52 of file freSingleValuedVnlSOMetricAdaptor.h.

typedef double FREE::SingleValuedVnlSOMetricAdaptor::InternalMeasureType

InternalMeasureType typedef.

Definition at line 55 of file freSingleValuedVnlSOMetricAdaptor.h.

typedef vnl_vector<double> FREE::SingleValuedVnlSOMetricAdaptor::InternalDerivativeType

InternalGradientType typedef.

Definition at line 58 of file freSingleValuedVnlSOMetricAdaptor.h.

typedef SetupOptimizationMetric::ParametersType FREE::SingleValuedVnlSOMetricAdaptor::ParametersType

Parameters of the SetupOptimizationMetric

Definition at line 61 of file freSingleValuedVnlSOMetricAdaptor.h.

typedef itk::Array<double> FREE::SingleValuedVnlSOMetricAdaptor::DerivativeType

Derivatives of the SetupOptimizationMetric

Definition at line 64 of file freSingleValuedVnlSOMetricAdaptor.h.

typedef SetupOptimizationMetric::MeasureType FREE::SingleValuedVnlSOMetricAdaptor::MeasureType

Type of the SetupOptimizationMetric value

Definition at line 67 of file freSingleValuedVnlSOMetricAdaptor.h.

typedef SetupOptimizationMetric::DecomposedMeasureType FREE::SingleValuedVnlSOMetricAdaptor::DecomposedMeasureType

Definition at line 69 of file freSingleValuedVnlSOMetricAdaptor.h.

typedef itk::Array<double> FREE::SingleValuedVnlSOMetricAdaptor::ScalesType

Scales typedef

Definition at line 72 of file freSingleValuedVnlSOMetricAdaptor.h.

typedef itk::Array<double> FREE::SingleValuedVnlSOMetricAdaptor::MetricScalesType

Metric scales typedef

Definition at line 75 of file freSingleValuedVnlSOMetricAdaptor.h.


Constructor & Destructor Documentation

FREE::SingleValuedVnlSOMetricAdaptor::SingleValuedVnlSOMetricAdaptor ( unsigned int  spaceDimension  ) 

Constructor with size

Constructor.

Definition at line 29 of file freSingleValuedVnlSOMetricAdaptor.cxx.


Member Function Documentation

virtual const char* FREE::SingleValuedVnlSOMetricAdaptor::GetNameOfClass (  )  const [inline, virtual]

Reimplemented in FREE::SVLimitedAxisVnlSOMetricAdaptor.

Definition at line 77 of file freSingleValuedVnlSOMetricAdaptor.h.

void FREE::SingleValuedVnlSOMetricAdaptor::SetCostFunction ( SetupOptimizationMetric costFunction  )  [inline]

Set the CostFunction deriving from SingleValuedCostFunction

Definition at line 83 of file freSingleValuedVnlSOMetricAdaptor.h.

References m_CostFunction.

Referenced by FREE::LimitedAxisAmoebaSOOptimizer::SetCostFunction(), and FREE::AmoebaSOOptimizer::SetCostFunction().

const SetupOptimizationMetric* FREE::SingleValuedVnlSOMetricAdaptor::GetCostFunction ( void   )  const [inline]

Get the CostFunction deriving from SingleValuedCostFunction

Definition at line 87 of file freSingleValuedVnlSOMetricAdaptor.h.

References m_CostFunction.

SingleValuedVnlSOMetricAdaptor::InternalMeasureType FREE::SingleValuedVnlSOMetricAdaptor::f ( const InternalParametersType inparameters  )  [virtual]

Delegate computation of the value to the CostFunction.

Definition at line 94 of file freSingleValuedVnlSOMetricAdaptor.cxx.

References ConvertInternalToParameter(), m_CachedCurrentParameters, m_CachedDecomposedValue, m_CachedValue, m_CostFunction, m_NegateCostFunction, and ReportIteration().

Here is the call graph for this function:

FREE::SingleValuedVnlSOMetricAdaptor::ConvertInternalToParameterFREE::SingleValuedVnlSOMetricAdaptor::ReportIteration

void FREE::SingleValuedVnlSOMetricAdaptor::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 131 of file freSingleValuedVnlSOMetricAdaptor.cxx.

References ConvertExternalToInternalGradient(), ConvertInternalToParameter(), m_CachedCurrentParameters, m_CachedDerivative, m_CostFunction, and ReportIteration().

Here is the call graph for this function:

FREE::SingleValuedVnlSOMetricAdaptor::ConvertExternalToInternalGradientFREE::SingleValuedVnlSOMetricAdaptor::ConvertInternalToParameterFREE::SingleValuedVnlSOMetricAdaptor::ReportIteration

void FREE::SingleValuedVnlSOMetricAdaptor::compute ( const InternalParametersType x,
InternalMeasureType f,
InternalDerivativeType g 
) [virtual]

Delegate computation of value and gradient to the costFunction.

Delegate computation of value and gradient to the costfunction.

Definition at line 157 of file freSingleValuedVnlSOMetricAdaptor.cxx.

References ConvertExternalToInternalGradient(), ConvertInternalToParameter(), m_CachedCurrentParameters, m_CachedDecomposedValue, m_CachedDerivative, m_CachedValue, m_CostFunction, m_NegateCostFunction, and ReportIteration().

Here is the call graph for this function:

FREE::SingleValuedVnlSOMetricAdaptor::ConvertExternalToInternalGradientFREE::SingleValuedVnlSOMetricAdaptor::ConvertInternalToParameterFREE::SingleValuedVnlSOMetricAdaptor::ReportIteration

void FREE::SingleValuedVnlSOMetricAdaptor::ConvertExternalToInternalGradient ( const DerivativeType input,
InternalDerivativeType output 
) const

Convert external derviative measures into internal type

Convert external derviative measures into internal type

Definition at line 208 of file freSingleValuedVnlSOMetricAdaptor.cxx.

References m_NegateCostFunction.

Referenced by compute(), and gradf().

void FREE::SingleValuedVnlSOMetricAdaptor::SetScales ( const ScalesType scales  ) 

Set current parameters scaling.

Definition at line 41 of file freSingleValuedVnlSOMetricAdaptor.cxx.

References throwExceptionMacro.

Referenced by FREE::LimitedAxisAmoebaSOOptimizer::StartOptimization().

void FREE::SingleValuedVnlSOMetricAdaptor::SetNegateCostFunction ( bool  flag  ) 

Set/Get Negate cost function. The purpose of this boolean flag is to make possible to take certain VNL optimizers that are only minimizers, and use them for maximizing functions. When the boolean flag is set to true, the values returned by GetValue in the internal ITK cost function will be multiplied by -1 before returning it in the f() function. Similar operations will be done for the gradf() and compute() methods. When the boolean flag is set to false, then the values returned by the ITK cost function will be passed unchanged to the VNL optimizers.

Set whether the cost function should be negated or not. This is useful for adapting optimizers that are only minimizers.

Definition at line 231 of file freSingleValuedVnlSOMetricAdaptor.cxx.

References m_NegateCostFunction.

bool FREE::SingleValuedVnlSOMetricAdaptor::GetNegateCostFunction (  )  const

Returns whether the cost function is going to be negated or not. This is useful for adapting optimizers that are only minimizers.

Definition at line 240 of file freSingleValuedVnlSOMetricAdaptor.cxx.

References m_NegateCostFunction.

void FREE::SingleValuedVnlSOMetricAdaptor::NegateCostFunctionOn (  )  [inline]

Definition at line 121 of file freSingleValuedVnlSOMetricAdaptor.h.

References m_NegateCostFunction.

Referenced by FREE::LimitedAxisAmoebaSOOptimizer::StartOptimization().

void FREE::SingleValuedVnlSOMetricAdaptor::NegateCostFunctionOff (  )  [inline]

Definition at line 122 of file freSingleValuedVnlSOMetricAdaptor.h.

References m_NegateCostFunction.

unsigned long FREE::SingleValuedVnlSOMetricAdaptor::AddObserver ( const itk::EventObject &  event,
itk::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 258 of file freSingleValuedVnlSOMetricAdaptor.cxx.

References m_Reporter.

Referenced by FREE::VnlSetupOptimizationOptimizer::SetCostFunctionAdaptor().

const SingleValuedVnlSOMetricAdaptor::MeasureType & FREE::SingleValuedVnlSOMetricAdaptor::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 267 of file freSingleValuedVnlSOMetricAdaptor.cxx.

References m_CachedValue.

Referenced by FREE::VnlSetupOptimizationOptimizer::IterationReport().

const SingleValuedVnlSOMetricAdaptor::DecomposedMeasureType & FREE::SingleValuedVnlSOMetricAdaptor::GetCachedDecomposedValue (  )  const

Return the cached value of the cost function

Definition at line 275 of file freSingleValuedVnlSOMetricAdaptor.cxx.

References m_CachedDecomposedValue.

Referenced by FREE::VnlSetupOptimizationOptimizer::IterationReport().

const SingleValuedVnlSOMetricAdaptor::DerivativeType & FREE::SingleValuedVnlSOMetricAdaptor::GetCachedDerivative (  )  const

Return the cached value of the cost function derivative

Definition at line 283 of file freSingleValuedVnlSOMetricAdaptor.cxx.

References m_CachedDerivative.

Referenced by FREE::VnlSetupOptimizationOptimizer::IterationReport().

const SingleValuedVnlSOMetricAdaptor::ParametersType & FREE::SingleValuedVnlSOMetricAdaptor::GetCachedCurrentParameters (  )  const

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

Definition at line 291 of file freSingleValuedVnlSOMetricAdaptor.cxx.

References m_CachedCurrentParameters.

Referenced by FREE::VnlSetupOptimizationOptimizer::IterationReport().

void FREE::SingleValuedVnlSOMetricAdaptor::ReportIteration ( const itk::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

Returns whether the cost function is going to be negated or not. This is useful for adapting optimizers that are only minimizers.

Definition at line 249 of file freSingleValuedVnlSOMetricAdaptor.cxx.

References m_Reporter.

Referenced by compute(), f(), and gradf().

SingleValuedVnlSOMetricAdaptor::ParametersType FREE::SingleValuedVnlSOMetricAdaptor::ConvertInternalToParameter ( const InternalParametersType inparameters  )  [protected, virtual]

Definition at line 50 of file freSingleValuedVnlSOMetricAdaptor.cxx.

References m_Scales, and m_ScalesInitialized.

Referenced by compute(), f(), and gradf().

SingleValuedVnlSOMetricAdaptor::InternalParametersType FREE::SingleValuedVnlSOMetricAdaptor::ConvertParameterToInternal ( const ParametersType parameters  )  [protected, virtual]

Definition at line 71 of file freSingleValuedVnlSOMetricAdaptor.cxx.

References m_Scales, and m_ScalesInitialized.


Member Data Documentation

SetupOptimizationMetric::Pointer FREE::SingleValuedVnlSOMetricAdaptor::m_CostFunction [protected]

Definition at line 148 of file freSingleValuedVnlSOMetricAdaptor.h.

Referenced by compute(), f(), GetCostFunction(), gradf(), and SetCostFunction().

bool FREE::SingleValuedVnlSOMetricAdaptor::m_ScalesInitialized [protected]

Definition at line 149 of file freSingleValuedVnlSOMetricAdaptor.h.

Referenced by ConvertInternalToParameter(), and ConvertParameterToInternal().

ScalesType FREE::SingleValuedVnlSOMetricAdaptor::m_Scales [protected]

Definition at line 150 of file freSingleValuedVnlSOMetricAdaptor.h.

Referenced by FREE::SVLimitedAxisVnlSOMetricAdaptor::ConvertInternalToParameter(), ConvertInternalToParameter(), FREE::SVLimitedAxisVnlSOMetricAdaptor::ConvertParameterToInternal(), and ConvertParameterToInternal().

bool FREE::SingleValuedVnlSOMetricAdaptor::m_NegateCostFunction [protected]

Definition at line 151 of file freSingleValuedVnlSOMetricAdaptor.h.

Referenced by compute(), ConvertExternalToInternalGradient(), f(), GetNegateCostFunction(), NegateCostFunctionOff(), NegateCostFunctionOn(), and SetNegateCostFunction().

itk::Object::Pointer FREE::SingleValuedVnlSOMetricAdaptor::m_Reporter [protected]

Definition at line 152 of file freSingleValuedVnlSOMetricAdaptor.h.

Referenced by AddObserver(), and ReportIteration().

MeasureType FREE::SingleValuedVnlSOMetricAdaptor::m_CachedValue [mutable, protected]

Definition at line 154 of file freSingleValuedVnlSOMetricAdaptor.h.

Referenced by compute(), f(), and GetCachedValue().

DecomposedMeasureType FREE::SingleValuedVnlSOMetricAdaptor::m_CachedDecomposedValue [mutable, protected]

Definition at line 155 of file freSingleValuedVnlSOMetricAdaptor.h.

Referenced by compute(), f(), and GetCachedDecomposedValue().

DerivativeType FREE::SingleValuedVnlSOMetricAdaptor::m_CachedDerivative [mutable, protected]

Definition at line 156 of file freSingleValuedVnlSOMetricAdaptor.h.

Referenced by compute(), GetCachedDerivative(), and gradf().

ParametersType FREE::SingleValuedVnlSOMetricAdaptor::m_CachedCurrentParameters [mutable, protected]

Definition at line 157 of file freSingleValuedVnlSOMetricAdaptor.h.

Referenced by compute(), f(), GetCachedCurrentParameters(), and gradf().


The documentation for this class was generated from the following files:
Generated at Sat Oct 13 18:17:54 2007 for f.r.e.e. - Flexible Registration and Evaluation Engine by doxygen 1.5.3 written by Dimitri van Heesch, © 1997-2000