ITK  5.0.0
Insight Segmentation and Registration Toolkit
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
itk::SingleValuedVnlCostFunctionAdaptorv4 Class Reference

#include <itkSingleValuedVnlCostFunctionAdaptorv4.h>

+ Inheritance diagram for itk::SingleValuedVnlCostFunctionAdaptorv4:
+ Collaboration diagram for itk::SingleValuedVnlCostFunctionAdaptorv4:

Detailed Description

This class is an Adaptor that allows to pass itk::ObjectToObjectMetricBase objects to vnl_optimizers expecting a vnl_cost_function. For use in the ITKv4 registration framework.

This class returns a single value.

Definition at line 36 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

Public Types

using DerivativeType = ObjectToObjectMetricBase::DerivativeType
 
using InternalDerivativeType = vnl_vector< InternalMeasureType >
 
using InternalMeasureType = double
 
using InternalParametersType = vnl_vector< InternalMeasureType >
 
using MeasureType = ObjectToObjectMetricBase::MeasureType
 
using ParametersType = ObjectToObjectMetricBase::ParametersType
 
using ScalesType = OptimizerParameters< InternalMeasureType >
 

Public Member Functions

unsigned long AddObserver (const EventObject &event, Command *) const
 
void compute (const InternalParametersType &x, InternalMeasureType *f, InternalDerivativeType *g) override
 
void ConvertExternalToInternalGradient (const DerivativeType &input, InternalDerivativeType &output) const
 
InternalMeasureType f (const InternalParametersType &inparameters) override
 
const ParametersTypeGetCachedCurrentParameters () const
 
virtual const DerivativeTypeGetCachedDerivative () const
 
virtual const MeasureTypeGetCachedValue () const
 
const ObjectToObjectMetricBaseGetCostFunction () const
 
void gradf (const InternalParametersType &inparameters, InternalDerivativeType &gradient) override
 
void SetCostFunction (ObjectToObjectMetricBase *costFunction)
 
void SetScales (const ScalesType &scales)
 
 SingleValuedVnlCostFunctionAdaptorv4 (unsigned int spaceDimension)
 

Protected Member Functions

void ReportIteration (const EventObject &event) const
 

Private Attributes

DerivativeType m_CachedDerivative
 
MeasureType m_CachedValue
 
ObjectToObjectMetricBase::Pointer m_ObjectMetric
 
Object::Pointer m_Reporter
 
ScalesType m_Scales
 
bool m_ScalesInitialized
 

Member Typedef Documentation

Derivatives of the SingleValuedCostFunction

Definition at line 54 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

InternalGradientType type alias.

Definition at line 48 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

InternalMeasureType type alias.

Definition at line 42 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

InternalParametersType type alias.

Definition at line 45 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

Type of the SingleValuedCostFunction value

Definition at line 57 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

Parameters of the SingleValuedCostFunction

Definition at line 51 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

Scales type alias

Definition at line 60 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

Constructor & Destructor Documentation

itk::SingleValuedVnlCostFunctionAdaptorv4::SingleValuedVnlCostFunctionAdaptorv4 ( unsigned int  spaceDimension)

Constructor with size

Member Function Documentation

unsigned long itk::SingleValuedVnlCostFunctionAdaptorv4::AddObserver ( const EventObject event,
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.

void itk::SingleValuedVnlCostFunctionAdaptorv4::compute ( const InternalParametersType x,
InternalMeasureType f,
InternalDerivativeType g 
)
override

Delegate computation of value and gradient to the costFunction.

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

Convert external derviative measures into internal type

InternalMeasureType itk::SingleValuedVnlCostFunctionAdaptorv4::f ( const InternalParametersType inparameters)
override

Delegate computation of the value to the CostFunction.

const ParametersType& itk::SingleValuedVnlCostFunctionAdaptorv4::GetCachedCurrentParameters ( ) const

Return the parameters directly from the assigned metric.

virtual const DerivativeType& itk::SingleValuedVnlCostFunctionAdaptorv4::GetCachedDerivative ( ) const
virtual
virtual const MeasureType& itk::SingleValuedVnlCostFunctionAdaptorv4::GetCachedValue ( ) const
virtual

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.

const ObjectToObjectMetricBase* itk::SingleValuedVnlCostFunctionAdaptorv4::GetCostFunction ( ) const
inline

Get the CostFunction deriving from SingleValuedCostFunction

Definition at line 72 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

References m_ObjectMetric.

void itk::SingleValuedVnlCostFunctionAdaptorv4::gradf ( const InternalParametersType inparameters,
InternalDerivativeType gradient 
)
override

Delegate computation of the gradient to the costFunction.

void itk::SingleValuedVnlCostFunctionAdaptorv4::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

void itk::SingleValuedVnlCostFunctionAdaptorv4::SetCostFunction ( ObjectToObjectMetricBase costFunction)
inline

Set the CostFunction deriving from SingleValuedCostFunction

Definition at line 66 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

References m_ObjectMetric.

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

Set current parameters scaling.

Member Data Documentation

DerivativeType itk::SingleValuedVnlCostFunctionAdaptorv4::m_CachedDerivative
mutableprivate

Definition at line 123 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

MeasureType itk::SingleValuedVnlCostFunctionAdaptorv4::m_CachedValue
mutableprivate

Definition at line 122 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

ObjectToObjectMetricBase::Pointer itk::SingleValuedVnlCostFunctionAdaptorv4::m_ObjectMetric
private

Definition at line 117 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

Referenced by GetCostFunction(), and SetCostFunction().

Object::Pointer itk::SingleValuedVnlCostFunctionAdaptorv4::m_Reporter
private

Definition at line 120 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

ScalesType itk::SingleValuedVnlCostFunctionAdaptorv4::m_Scales
private

Definition at line 119 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

bool itk::SingleValuedVnlCostFunctionAdaptorv4::m_ScalesInitialized
private

Definition at line 118 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.


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