ITK  4.5.0
Insight Segmentation and Registration Toolkit
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType > Class Template Reference

#include <itkObjectToObjectOptimizerBase.h>

+ Inheritance diagram for itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >:
+ Collaboration diagram for itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >:

Detailed Description

template<typename TInternalComputationValueType>
class itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >

Abstract base for object-to-object optimizers.

The goal of this optimizer hierarchy is to work with metrics of any type, i.e. working with any kind of object, such as image or point-set.

Transform parameters are not manipulated directly. Instead, the optimizer retrieves the metric derivative from the metric, modifies the derivative as required, then passes it back to the metric as an update. The metric then processes it as appropriate, typically by passing it to its transform that is being optimized.

SetScales() allows setting of a per-local-parameter scaling array. The gradient of each local parameter is divided by the corresponding scale. If unset, the m_Scales array will be initialized to all 1's. Note that when used with transforms with local support, these scales correspond to each local parameter, and not to each parameter. For example, in a DisplacementFieldTransform of dimensionality N, the Scales is size N, with each element corresponding to a dimension within the transform's displacement field, and is applied to each vector in the displacement field.

SetWeights() allows setting of a per-local-parameter weighting array. If unset, the weights are treated as identity. Weights are multiplied by the gradient at the same time scaling is applied. Weights are different than scales, and may be used, for example, to easily mask out a particular parameter during optimzation to hold it constant. Or they may be used to apply another kind of prior knowledge.

Threading of some optimizer operations may be handled within derived classes, for example in GradientDescentOptimizer.

Note
Derived classes must override StartOptimization, and then call this base class version to perform common initializations.

Definition at line 67 of file itkObjectToObjectOptimizerBase.h.

Public Types

typedef SmartPointer< const SelfConstPointer
 
typedef MetricType::MeasureType MeasureType
 
typedef
ObjectToObjectMetricBaseTemplate
< TInternalComputationValueType > 
MetricType
 
typedef MetricType::Pointer MetricTypePointer
 
typedef
MetricType::NumberOfParametersType 
NumberOfParametersType
 
typedef OptimizerParameters
< TInternalComputationValueType > 
ParametersType
 
typedef SmartPointer< SelfPointer
 
typedef OptimizerParameters
< TInternalComputationValueType > 
ScalesType
 
typedef
ObjectToObjectOptimizerBaseTemplate 
Self
 
typedef Object Superclass
 
- Public Types inherited from itk::Object
typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< SelfPointer
 
typedef Object Self
 
typedef LightObject Superclass
 
- Public Types inherited from itk::LightObject
typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< SelfPointer
 
typedef LightObject Self
 

Public Member Functions

virtual const MeasureTypeGetCurrentMetricValue ()
 
virtual const ParametersTypeGetCurrentPosition () const
 
virtual const char * GetNameOfClass () const
 
virtual const ThreadIdTypeGetNumberOfThreads ()
 
virtual const ScalesTypeGetScales ()
 
virtual const bool & GetScalesAreIdentity ()
 
virtual const MeasureTypeGetValue () const
 
virtual const ScalesTypeGetWeights ()
 
virtual const bool & GetWeightsAreIdentity ()
 
virtual void SetNumberOfThreads (ThreadIdType number)
 
virtual void SetScales (ScalesType _arg)
 
virtual void SetWeights (ScalesType _arg)
 
virtual void StartOptimization (bool doOnlyInitialization=false)
 
virtual void SetMetric (MetricType *_arg)
 
virtual MetricTypeGetModifiableMetric ()
 
virtual const MetricTypeGetMetric () const
 
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *)
 
unsigned long AddObserver (const EventObject &event, Command *) const
 
virtual LightObject::Pointer CreateAnother () const
 
virtual void DebugOff () const
 
virtual void DebugOn () const
 
CommandGetCommand (unsigned long tag)
 
bool GetDebug () const
 
MetaDataDictionaryGetMetaDataDictionary (void)
 
const MetaDataDictionaryGetMetaDataDictionary (void) const
 
virtual ModifiedTimeType GetMTime () const
 
virtual const TimeStampGetTimeStamp () const
 
bool HasObserver (const EventObject &event) const
 
void InvokeEvent (const EventObject &)
 
void InvokeEvent (const EventObject &) const
 
virtual void Modified () const
 
virtual void Register () const
 
void RemoveAllObservers ()
 
void RemoveObserver (unsigned long tag)
 
void SetDebug (bool debugFlag) const
 
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
 
virtual void SetReferenceCount (int)
 
virtual void UnRegister () const
 
virtual void SetObjectName (std::string _arg)
 
virtual const std::string & GetObjectName ()
 
- Public Member Functions inherited from itk::LightObject
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
 itkCloneMacro (Self)
 
void Print (std::ostream &os, Indent indent=0) const
 

Protected Member Functions

virtual void PrintSelf (std::ostream &os, Indent indent) const
 
 ObjectToObjectOptimizerBaseTemplate ()
 
virtual ~ObjectToObjectOptimizerBaseTemplate ()
 
- Protected Member Functions inherited from itk::Object
 Object ()
 
bool PrintObservers (std::ostream &os, Indent indent) const
 
virtual void SetTimeStamp (const TimeStamp &time)
 
virtual ~Object ()
 
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 
 LightObject ()
 
virtual void PrintHeader (std::ostream &os, Indent indent) const
 
virtual void PrintTrailer (std::ostream &os, Indent indent) const
 
virtual ~LightObject ()
 

Protected Attributes

MeasureType m_CurrentMetricValue
 
MetricTypePointer m_Metric
 
ThreadIdType m_NumberOfThreads
 
ScalesType m_Scales
 
bool m_ScalesAreIdentity
 
ScalesType m_Weights
 
bool m_WeightsAreIdentity
 
- Protected Attributes inherited from itk::LightObject
InternalReferenceCountType m_ReferenceCount
 
SimpleFastMutexLock m_ReferenceCountLock
 

Private Member Functions

 ObjectToObjectOptimizerBaseTemplate (const Self &)
 
void operator= (const Self &)
 

Additional Inherited Members

- Static Public Member Functions inherited from itk::Object
static bool GetGlobalWarningDisplay ()
 
static void GlobalWarningDisplayOff ()
 
static void GlobalWarningDisplayOn ()
 
static Pointer New ()
 
static void SetGlobalWarningDisplay (bool flag)
 
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 
- Protected Types inherited from itk::LightObject
typedef int InternalReferenceCountType
 

Member Typedef Documentation

template<typename TInternalComputationValueType>
typedef SmartPointer< const Self > itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::ConstPointer

Definition at line 74 of file itkObjectToObjectOptimizerBase.h.

template<typename TInternalComputationValueType>
typedef MetricType::MeasureType itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::MeasureType

Measure type

Definition at line 93 of file itkObjectToObjectOptimizerBase.h.

template<typename TInternalComputationValueType>
typedef ObjectToObjectMetricBaseTemplate< TInternalComputationValueType > itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::MetricType

Metric function type

Definition at line 86 of file itkObjectToObjectOptimizerBase.h.

template<typename TInternalComputationValueType>
typedef MetricType::Pointer itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::MetricTypePointer

Definition at line 87 of file itkObjectToObjectOptimizerBase.h.

template<typename TInternalComputationValueType>
typedef MetricType::NumberOfParametersType itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::NumberOfParametersType

Number of parameters type

Definition at line 90 of file itkObjectToObjectOptimizerBase.h.

template<typename TInternalComputationValueType>
typedef OptimizerParameters< TInternalComputationValueType > itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::ParametersType

Parameters type.

Definition at line 83 of file itkObjectToObjectOptimizerBase.h.

template<typename TInternalComputationValueType>
typedef SmartPointer< Self > itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::Pointer

Definition at line 73 of file itkObjectToObjectOptimizerBase.h.

template<typename TInternalComputationValueType>
typedef OptimizerParameters< TInternalComputationValueType > itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::ScalesType

Scale type.

Definition at line 77 of file itkObjectToObjectOptimizerBase.h.

template<typename TInternalComputationValueType>
typedef ObjectToObjectOptimizerBaseTemplate itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::Self

Standard class typedefs.

Definition at line 71 of file itkObjectToObjectOptimizerBase.h.

template<typename TInternalComputationValueType>
typedef Object itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::Superclass

Definition at line 72 of file itkObjectToObjectOptimizerBase.h.

Constructor & Destructor Documentation

template<typename TInternalComputationValueType>
itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::ObjectToObjectOptimizerBaseTemplate ( )
protected

Default constructor

template<typename TInternalComputationValueType>
virtual itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::~ObjectToObjectOptimizerBaseTemplate ( )
protectedvirtual

Default constructor

template<typename TInternalComputationValueType>
itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::ObjectToObjectOptimizerBaseTemplate ( const Self )
private

Member Function Documentation

template<typename TInternalComputationValueType>
virtual const MeasureType& itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::GetCurrentMetricValue ( )
virtual

Accessor for metric value. Returns the value stored in m_CurrentMetricValue from the most recent call to evaluate the metric.

template<typename TInternalComputationValueType>
virtual const ParametersType& itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::GetCurrentPosition ( ) const
virtual

Get a reference to the current position of the optimization. This returns the parameters from the assigned metric, since the optimizer itself does not store a position.

template<typename TInternalComputationValueType>
virtual const MetricType* itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::GetMetric ( ) const
virtual

Accessors for Metric

template<typename TInternalComputationValueType>
virtual MetricType* itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::GetModifiableMetric ( )
virtual

Accessors for Metric

template<typename TInternalComputationValueType>
virtual const char* itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::GetNameOfClass ( ) const
virtual
template<typename TInternalComputationValueType>
virtual const ThreadIdType& itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::GetNumberOfThreads ( )
virtual

Get the number of threads set to be used.

template<typename TInternalComputationValueType>
virtual const ScalesType& itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::GetScales ( )
virtual

Get current parameters scaling.

template<typename TInternalComputationValueType>
virtual const bool& itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::GetScalesAreIdentity ( )
virtual

Get whether scales are identity. Cannot be set

template<typename TInternalComputationValueType>
virtual const MeasureType& itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::GetValue ( ) const
virtual

Deprecated accessor for currently stored metric value for use by classes that support both v4 and v3 optimizers.

See Also
GetCurrentMetricValue()
template<typename TInternalComputationValueType>
virtual const ScalesType& itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::GetWeights ( )
virtual

Get current parameters weights. This will return an empty array when weights have not been set by user.

template<typename TInternalComputationValueType>
virtual const bool& itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::GetWeightsAreIdentity ( )
virtual

Get whether weights are identity. Cannot be set

template<typename TInternalComputationValueType>
void itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::operator= ( const Self )
private
template<typename TInternalComputationValueType>
virtual void itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::PrintSelf ( std::ostream &  os,
Indent  indent 
) const
protectedvirtual
template<typename TInternalComputationValueType>
virtual void itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::SetMetric ( MetricType _arg)
virtual

Accessors for Metric

template<typename TInternalComputationValueType>
virtual void itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::SetNumberOfThreads ( ThreadIdType  number)
virtual

Set the number of threads to use when threading. The default is the global default number of threads returned from itkMultiThreader.

template<typename TInternalComputationValueType>
virtual void itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::SetScales ( ScalesType  _arg)
virtual

Set current parameters scaling.

template<typename TInternalComputationValueType>
virtual void itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::SetWeights ( ScalesType  _arg)
virtual

Set current parameters weights.

template<typename TInternalComputationValueType>
virtual void itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::StartOptimization ( bool  doOnlyInitialization = false)
virtual

Run the optimization.

Parameters
doOnlyInitializationThis is false by default. It should only be set to true for special cases when the class should be initialized to perform optimization, but no optimization should be run. For example, itkMultiGradientOptimizerv4 needs to do this.
Note
Derived classes must override and call this superclass method, then perform any additional initialization before performing optimization.

Reimplemented in itk::GradientDescentOptimizerv4Template< TInternalComputationValueType >, itk::MultiStartOptimizerv4Template< TInternalComputationValueType >, itk::MultiGradientOptimizerv4Template< TInternalComputationValueType >, itk::QuasiNewtonOptimizerv4Template< TInternalComputationValueType >, and itk::ConjugateGradientLineSearchOptimizerv4Template< TInternalComputationValueType >.

Member Data Documentation

template<typename TInternalComputationValueType>
MeasureType itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::m_CurrentMetricValue
protected

Metric measure value at a given iteration, as most recently evaluated.

Definition at line 164 of file itkObjectToObjectOptimizerBase.h.

template<typename TInternalComputationValueType>
MetricTypePointer itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::m_Metric
protected

Definition at line 160 of file itkObjectToObjectOptimizerBase.h.

template<typename TInternalComputationValueType>
ThreadIdType itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::m_NumberOfThreads
protected

Definition at line 161 of file itkObjectToObjectOptimizerBase.h.

template<typename TInternalComputationValueType>
ScalesType itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::m_Scales
protected

Scales. Size is expected to be == metric->GetNumberOfLocalParameters(). See the main documentation for more details.

Definition at line 168 of file itkObjectToObjectOptimizerBase.h.

template<typename TInternalComputationValueType>
bool itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::m_ScalesAreIdentity
protected

Flag to avoid unnecessary arithmetic when scales are identity.

Definition at line 177 of file itkObjectToObjectOptimizerBase.h.

template<typename TInternalComputationValueType>
ScalesType itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::m_Weights
protected

Parameter weights. These are applied to local parameters, at the same time as scales. See main documentation. If not set by user, the array remains empty and treated as identity to simplify the reuse of an optimizer with transforms with different numbers of parameters.

Definition at line 174 of file itkObjectToObjectOptimizerBase.h.

template<typename TInternalComputationValueType>
bool itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >::m_WeightsAreIdentity
protected

Flag to avoid unnecessary arithmetic when weights are identity.

Definition at line 180 of file itkObjectToObjectOptimizerBase.h.


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