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

#include <itkSingleValuedVnlCostFunctionAdaptorv4.h>

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 37 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

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

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 *fun, 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

◆ DerivativeType

Derivatives of the SingleValuedCostFunction

Definition at line 54 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

◆ InternalDerivativeType

InternalGradientType type alias.

Definition at line 48 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

◆ InternalMeasureType

InternalMeasureType type alias.

Definition at line 42 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

◆ InternalParametersType

InternalParametersType type alias.

Definition at line 45 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

◆ MeasureType

Type of the SingleValuedCostFunction value

Definition at line 57 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

◆ ParametersType

Parameters of the SingleValuedCostFunction

Definition at line 51 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

◆ ScalesType

Scales type alias

Definition at line 60 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

Constructor & Destructor Documentation

◆ SingleValuedVnlCostFunctionAdaptorv4()

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

Constructor with size

Member Function Documentation

◆ AddObserver()

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.

◆ compute()

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

Delegate computation of value and gradient to the costFunction.

◆ ConvertExternalToInternalGradient()

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

Convert external derivative measures into internal type

◆ f()

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

Delegate computation of the value to the CostFunction.

◆ GetCachedCurrentParameters()

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

Return the parameters directly from the assigned metric.

◆ GetCachedDerivative()

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

◆ GetCachedValue()

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.

◆ GetCostFunction()

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

Get the CostFunction deriving from SingleValuedCostFunction

Definition at line 74 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

References m_ObjectMetric.

◆ gradf()

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

Delegate computation of the gradient to the costFunction.

◆ ReportIteration()

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

◆ SetCostFunction()

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

Set the CostFunction deriving from SingleValuedCostFunction

Definition at line 67 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

References m_ObjectMetric.

◆ SetScales()

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

Set current parameters scaling.

Member Data Documentation

◆ m_CachedDerivative

DerivativeType itk::SingleValuedVnlCostFunctionAdaptorv4::m_CachedDerivative {}
mutableprivate

Definition at line 131 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

◆ m_CachedValue

MeasureType itk::SingleValuedVnlCostFunctionAdaptorv4::m_CachedValue {}
mutableprivate

Definition at line 130 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

◆ m_ObjectMetric

ObjectToObjectMetricBase::Pointer itk::SingleValuedVnlCostFunctionAdaptorv4::m_ObjectMetric {}
private

Definition at line 125 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

Referenced by GetCostFunction(), and SetCostFunction().

◆ m_Reporter

Object::Pointer itk::SingleValuedVnlCostFunctionAdaptorv4::m_Reporter {}
private

Definition at line 128 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

◆ m_Scales

ScalesType itk::SingleValuedVnlCostFunctionAdaptorv4::m_Scales {}
private

Definition at line 127 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.

◆ m_ScalesInitialized

bool itk::SingleValuedVnlCostFunctionAdaptorv4::m_ScalesInitialized {}
private

Definition at line 126 of file itkSingleValuedVnlCostFunctionAdaptorv4.h.


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