NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage > Class Template Referenceabstract

Abstract base class to provide functionality for adding arbitrary constraints, and also arbitrary ways of evaluating a derivative, both via Template Method pattern [2]. More...

Inheritance diagram for itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >:
Inheritance graph
[legend]
Collaboration diagram for itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >:
Collaboration graph
[legend]

Public Types

typedef
ImageToImageMetricWithConstraint 
Self
 
typedef ImageToImageMetric
< TFixedImage, TMovingImage > 
Superclass
 
typedef SmartPointer< SelfPointer
 
typedef SmartPointer< const SelfConstPointer
 
typedef itk::Constraint ConstraintType
 
typedef ConstraintType::Pointer ConstraintPointer
 
typedef MetricDerivativeBridge
< TFixedImage, TMovingImage > 
MetricDerivativeBridgeType
 
typedef
MetricDerivativeBridgeType::Pointer 
MetricDerivativePointer
 
typedef Superclass::MeasureType MeasureType
 
typedef Superclass::DerivativeType DerivativeType
 
typedef Superclass::ParametersType TransformParametersType
 

Public Member Functions

virtual const char * GetClassName () const
 
virtual void SetDerivativeBridge (MetricDerivativeBridgeType *_arg)
 
virtual
MetricDerivativeBridgeType
GetDerivativeBridge ()
 
virtual void SetConstraint (ConstraintType *_arg)
 
virtual ConstraintTypeGetConstraint ()
 
virtual void SetWeightingFactor (double _arg)
 
virtual double GetWeightingFactor ()
 
virtual void SetUseConstraintGradient (bool _arg)
 
virtual bool GetUseConstraintGradient () const
 
virtual void SetPrintOutMetricEvaluation (bool _arg)
 
virtual bool GetPrintOutMetricEvaluation ()
 
virtual MeasureType GetValue (const TransformParametersType &parameters) const
 
virtual void GetConstraintDerivative (const TransformParametersType &parameters, DerivativeType &derivative) const
 
virtual void GetDerivative (const TransformParametersType &parameters, DerivativeType &derivative) const
 
virtual void GetValueAndDerivative (const TransformParametersType &parameters, MeasureType &Value, DerivativeType &derivative) const
 

Protected Member Functions

 ImageToImageMetricWithConstraint ()
 
virtual ~ImageToImageMetricWithConstraint ()
 
void PrintSelf (std::ostream &os, Indent indent) const
 
virtual MeasureType GetSimilarity (const TransformParametersType &parameters) const =0
 
virtual void GetCostFunctionDerivative (const TransformParametersType &parameters, DerivativeType &derivative) const =0
 

Protected Attributes

MetricDerivativePointer m_DerivativeBridge
 
ConstraintPointer m_Constraint
 
double m_WeightingFactor
 
bool m_UseConstraintGradient
 
bool m_PrintOutMetricEvaluation
 

Detailed Description

template<typename TFixedImage, typename TMovingImage>
class itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >

Abstract base class to provide functionality for adding arbitrary constraints, and also arbitrary ways of evaluating a derivative, both via Template Method pattern [2].

We also provide a boolean to turn the gradient of the constraint off/on, as this could be expensive, and also, an independent debugging parameter. When you evaluate the similarity measure, do you want to print out the result for debugging purposes? i.e. like:

"GetValue():Actual metric value x = similarity * (1-weighting) + constraintg * (weighting)"

This may be ok for Fluid,FFD or normal affine registration where you evaluate the similarity measure once per iteration, or once + NDOF*2 if you include the finite difference derivative. But its completely useless for block matching, where you may evaluate the similarity measure (albeit on a small block) many thousands of times per iteration. So, we can't turn this feature off/on based on logging, or else you would need different logging every time you ran a block matching. We can't turn this feature off/on using the base class, or global debug flag. So, ive added a boolean m_PrintOutMetricEvaluation, which defaults to true.

Member Typedef Documentation

template<typename TFixedImage , typename TMovingImage >
typedef SmartPointer<const Self> itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::ConstPointer
template<typename TFixedImage , typename TMovingImage >
typedef ConstraintType::Pointer itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::ConstraintPointer
template<typename TFixedImage , typename TMovingImage >
typedef itk::Constraint itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::ConstraintType

This class enables a global constraint to be added.

template<typename TFixedImage , typename TMovingImage >
typedef Superclass::DerivativeType itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::DerivativeType
template<typename TFixedImage , typename TMovingImage >
typedef Superclass::MeasureType itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::MeasureType

For parameters and derivatives.

template<typename TFixedImage , typename TMovingImage >
typedef MetricDerivativeBridge<TFixedImage, TMovingImage> itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::MetricDerivativeBridgeType

This class enables a derivative bridge to be added.

template<typename TFixedImage , typename TMovingImage >
typedef MetricDerivativeBridgeType::Pointer itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::MetricDerivativePointer
template<typename TFixedImage , typename TMovingImage >
typedef SmartPointer<Self> itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::Pointer
template<typename TFixedImage , typename TMovingImage >
typedef ImageToImageMetricWithConstraint itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::Self

Standard class typedefs.

template<typename TFixedImage , typename TMovingImage >
typedef ImageToImageMetric<TFixedImage, TMovingImage > itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::Superclass
template<typename TFixedImage , typename TMovingImage >
typedef Superclass::ParametersType itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::TransformParametersType

Constructor & Destructor Documentation

template<typename TFixedImage , typename TMovingImage >
itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::ImageToImageMetricWithConstraint ( )
protected
template<typename TFixedImage , typename TMovingImage >
virtual itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::~ImageToImageMetricWithConstraint ( )
inlineprotectedvirtual

Member Function Documentation

template<typename TFixedImage , typename TMovingImage >
virtual const char* itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::GetClassName ( ) const
virtual
template<typename TFixedImage , typename TMovingImage >
virtual ConstraintType* itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::GetConstraint ( )
virtual
template<typename TFixedImage , typename TMovingImage >
virtual void itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::GetConstraintDerivative ( const TransformParametersType parameters,
DerivativeType derivative 
) const
virtual

Takes the supplied parameters array, and a derivative array, calculate the derivative of the constraint, and ADDS it to the supplied array.

template<typename TFixedImage , typename TMovingImage >
virtual void itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::GetCostFunctionDerivative ( const TransformParametersType parameters,
DerivativeType derivative 
) const
protectedpure virtual

Derived classes must implement this to calculate the derivative of the cost function.

Implemented in itk::JacobianGradientSimilarityMeasure< TFixedImage, TMovingImage >.

template<typename TFixedImage , typename TMovingImage >
virtual void itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::GetDerivative ( const TransformParametersType parameters,
DerivativeType derivative 
) const
virtual

Get the derivatives of the cost function, which can include the derivative of the constraint if UseConstraintGradient is true.

Note that this method is provided here in this base class, so that potentially any registration method could use this mechanism. However, if you look at the itkFFDGradientDescentOptimizer, you will notice that the BSpline stuff doesnt call this GetDerivative. i.e. the registration is not driven by a regular optimizer that calls GetValueAndDerivative.

template<typename TFixedImage , typename TMovingImage >
virtual MetricDerivativeBridgeType* itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::GetDerivativeBridge ( )
virtual
template<typename TFixedImage , typename TMovingImage >
virtual bool itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::GetPrintOutMetricEvaluation ( )
virtual
template<typename TFixedImage , typename TMovingImage >
virtual MeasureType itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::GetSimilarity ( const TransformParametersType parameters) const
protectedpure virtual

Derived classes must implement this to calculate the similarity measure.

Implemented in itk::SimilarityMeasure< TFixedImage, TMovingImage >.

template<typename TFixedImage , typename TMovingImage >
virtual bool itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::GetUseConstraintGradient ( ) const
virtual
template<typename TFixedImage , typename TMovingImage >
virtual MeasureType itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::GetValue ( const TransformParametersType parameters) const
virtual

Get the value of the cost function, which will include the weighted constraint.

template<typename TFixedImage , typename TMovingImage >
virtual void itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::GetValueAndDerivative ( const TransformParametersType parameters,
MeasureType Value,
DerivativeType derivative 
) const
virtual

Simply calls GetValue and then GetDerivative, both of which could be virtual/overriden.

template<typename TFixedImage , typename TMovingImage >
virtual double itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::GetWeightingFactor ( )
virtual
template<typename TFixedImage , typename TMovingImage >
void itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::PrintSelf ( std::ostream &  os,
Indent  indent 
) const
protected
template<typename TFixedImage , typename TMovingImage >
virtual void itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::SetConstraint ( ConstraintType _arg)
virtual

Set/Get an optional constraint.

template<typename TFixedImage , typename TMovingImage >
virtual void itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::SetDerivativeBridge ( MetricDerivativeBridgeType _arg)
virtual

Methods to Set/Get an optional derivative bridge.

template<typename TFixedImage , typename TMovingImage >
virtual void itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::SetPrintOutMetricEvaluation ( bool  _arg)
virtual

Turn on/off the printing out of the metric evaluation. Default on.

template<typename TFixedImage , typename TMovingImage >
virtual void itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::SetUseConstraintGradient ( bool  _arg)
virtual

Turn the derivative of constraint on or off, as this could be very expensive.

template<typename TFixedImage , typename TMovingImage >
virtual void itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::SetWeightingFactor ( double  _arg)
virtual

Set the weighting factor.

Member Data Documentation

template<typename TFixedImage , typename TMovingImage >
ConstraintPointer itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::m_Constraint
protected

A pointer to a constraint. This can be anything that returns a simple number.

template<typename TFixedImage , typename TMovingImage >
MetricDerivativePointer itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::m_DerivativeBridge
protected

A pointer to a MetricDerivativeBrige which can be used to delegate to potentially anything that can evaluate the derivative of the cost function.

template<typename TFixedImage , typename TMovingImage >
bool itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::m_PrintOutMetricEvaluation
protected

Print out the metric evaluation. Default true.

template<typename TFixedImage , typename TMovingImage >
bool itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::m_UseConstraintGradient
protected

Turn derivative of constraint on or off. Default off.

template<typename TFixedImage , typename TMovingImage >
double itk::ImageToImageMetricWithConstraint< TFixedImage, TMovingImage >::m_WeightingFactor
protected

The weighting between the constraint and the cost function. Default 0.01 (99% cost function).


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