ITK  5.1.0
Insight Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
itk::ExhaustiveOptimizerv4< TInternalComputationValueType > Class Template Reference

#include <itkExhaustiveOptimizerv4.h>

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

Public Types

using ConstPointer = SmartPointer< const Self >
 
using MeasureType = typename Superclass::MeasureType
 
using ParametersType = typename Superclass::ParametersType
 
using Pointer = SmartPointer< Self >
 
using ScalesType = typename Superclass::ScalesType
 
using Self = ExhaustiveOptimizerv4
 
using StepsType = Array< SizeValueType >
 
using Superclass = ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >
 
- Public Types inherited from itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >
using ConstPointer = SmartPointer< const Self >
 
using DerivativeType = typename MetricType::DerivativeType
 
using MeasureType = typename MetricType::MeasureType
 
using MetricType = ObjectToObjectMetricBaseTemplate< TInternalComputationValueType >
 
using MetricTypePointer = typename MetricType::Pointer
 
using NumberOfParametersType = typename MetricType::NumberOfParametersType
 
using ParametersType = OptimizerParameters< TInternalComputationValueType >
 
using Pointer = SmartPointer< Self >
 
using ScalesEstimatorType = OptimizerParameterScalesEstimatorTemplate< TInternalComputationValueType >
 
using ScalesType = OptimizerParameters< TInternalComputationValueType >
 
using Self = ObjectToObjectOptimizerBaseTemplate
 
using StopConditionDescriptionType = std::ostringstream
 
using StopConditionReturnStringType = std::string
 
using Superclass = Object
 
- Public Types inherited from itk::Object
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = Object
 
using Superclass = LightObject
 
- Public Types inherited from itk::LightObject
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = LightObject
 

Public Member Functions

virtual ::itk::LightObject::Pointer CreateAnother () const
 
virtual const ParametersTypeGetCurrentIndex () const
 
virtual const MeasureTypeGetCurrentValue () const
 
ParametersTypeGetInitialPosition ()
 
virtual const MeasureTypeGetMaximumMetricValue () const
 
virtual const ParametersTypeGetMaximumMetricValuePosition () const
 
virtual const MeasureTypeGetMinimumMetricValue () const
 
virtual const ParametersTypeGetMinimumMetricValuePosition () const
 
virtual const char * GetNameOfClass () const
 
virtual const StepsTypeGetNumberOfSteps () const
 
virtual const double & GetStepLength () const
 
const std::string GetStopConditionDescription () const override
 
void ResumeWalking ()
 
void SetInitialPosition (const ParametersType &param)
 
virtual void SetNumberOfSteps (StepsType _arg)
 
virtual void SetStepLength (double _arg)
 
void StartOptimization (bool doOnlyInitialization=false) override
 
void StartWalking ()
 
void StopWalking ()
 
- Public Member Functions inherited from itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >
virtual void SetMetric (MetricType *_arg)
 
virtual MetricTypeGetModifiableMetric ()
 
virtual const MetricTypeGetMetric () const
 
virtual const MeasureTypeGetCurrentMetricValue () const
 
virtual const MeasureTypeGetValue () const
 
virtual void SetScales (const ScalesType &scales)
 
virtual const ScalesTypeGetScales () const
 
virtual const bool & GetScalesAreIdentity () const
 
virtual void SetWeights (ScalesType _arg)
 
virtual const ScalesTypeGetWeights () const
 
virtual const bool & GetWeightsAreIdentity () const
 
bool GetScalesInitialized () const
 
virtual void SetScalesEstimator (ScalesEstimatorType *_arg)
 
virtual void SetDoEstimateScales (bool _arg)
 
virtual const bool & GetDoEstimateScales () const
 
virtual void DoEstimateScalesOn ()
 
virtual void DoEstimateScalesOff ()
 
virtual void SetNumberOfWorkUnits (ThreadIdType number)
 
virtual const ThreadIdTypeGetNumberOfWorkUnits () const
 
virtual SizeValueType GetCurrentIteration () const
 
virtual void SetNumberOfIterations (SizeValueType _arg)
 
virtual SizeValueType GetNumberOfIterations () const
 
virtual const ParametersTypeGetCurrentPosition () const
 
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *)
 
unsigned long AddObserver (const EventObject &event, Command *) const
 
virtual void DebugOff () const
 
virtual void DebugOn () const
 
CommandGetCommand (unsigned long tag)
 
bool GetDebug () const
 
MetaDataDictionaryGetMetaDataDictionary ()
 
const MetaDataDictionaryGetMetaDataDictionary () 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
 
void Register () const override
 
void RemoveAllObservers ()
 
void RemoveObserver (unsigned long tag)
 
void SetDebug (bool debugFlag) const
 
void SetReferenceCount (int) override
 
void UnRegister () const noexcept override
 
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
 
void SetMetaDataDictionary (MetaDataDictionary &&rrhs)
 
virtual void SetObjectName (std::string _arg)
 
virtual const std::string & GetObjectName () const
 
- 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
 

Static Public Member Functions

static Pointer New ()
 
- 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 Member Functions

void AdvanceOneStep ()
 
 ExhaustiveOptimizerv4 ()
 
void IncrementIndex (ParametersType &param)
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
 ~ExhaustiveOptimizerv4 () override=default
 
- Protected Member Functions inherited from itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >
 ObjectToObjectOptimizerBaseTemplate ()
 
 ~ObjectToObjectOptimizerBaseTemplate () override
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
- Protected Member Functions inherited from itk::Object
 Object ()
 
 ~Object () override
 
bool PrintObservers (std::ostream &os, Indent indent) const
 
virtual void SetTimeStamp (const TimeStamp &time)
 
- 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

ParametersType m_CurrentIndex
 
MeasureType m_CurrentValue
 
ParametersType m_InitialPosition
 
MeasureType m_MaximumMetricValue
 
ParametersType m_MaximumMetricValuePosition
 
MeasureType m_MinimumMetricValue
 
ParametersType m_MinimumMetricValuePosition
 
StepsType m_NumberOfSteps
 
double m_StepLength { 1.0 }
 
bool m_Stop { false }
 
- Protected Attributes inherited from itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >
MetricTypePointer m_Metric
 
ThreadIdType m_NumberOfWorkUnits
 
SizeValueType m_CurrentIteration
 
SizeValueType m_NumberOfIterations
 
MeasureType m_CurrentMetricValue
 
ScalesType m_Scales
 
ScalesType m_Weights
 
bool m_ScalesAreIdentity
 
ScalesEstimatorType::Pointer m_ScalesEstimator
 
bool m_WeightsAreIdentity
 
bool m_DoEstimateScales
 
- Protected Attributes inherited from itk::LightObject
std::atomic< int > m_ReferenceCount
 

Private Attributes

std::ostringstream m_StopConditionDescription
 

Detailed Description

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

Optimizer that fully samples a grid on the parametric space.

This optimizer is equivalent to an exhaustive search in a discrete grid defined over the parametric space. The grid is centered on the initial position. The subdivisions of the grid along each one of the dimensions of the parametric space is defined by an array of number of steps.

A typical use is to plot the metric space to get an idea of how noisy it is. An example is given below, where it is desired to plot the metric space with respect to translations along x, y and z in a 3D registration application: Here it is assumed that the transform is Euler3DTransform.

OptimizerType::StepsType steps( m_Transform->GetNumberOfParameters() );
steps[0] = 10;
steps[1] = 10;
steps[2] = 10;
m_Optimizer->SetNumberOfSteps( steps );
m_Optimizer->SetStepLength( 2 );

The optimizer throws IterationEvents after every iteration. We use this to plot the metric space in an image as follows:

if( itk::IterationEvent().CheckEvent(& event ) )
{
IndexType index;
index[0] = m_Optimizer->GetCurrentIndex()[0];
index[1] = m_Optimizer->GetCurrentIndex()[1];
index[2] = m_Optimizer->GetCurrentIndex()[2];
image->SetPixel( index, m_Optimizer->GetCurrentValue() );
}

The image size is expected to be 11 x 11 x 11.

If you wish to use different step lengths along each parametric axis, you can use the SetScales() method. This accepts an array, each element represents the number of subdivisions per step length. For instance scales of [0.5 1 4] along with a step length of 2 will cause the optimizer to search the metric space on a grid with x,y,z spacing of [1 2 8].

Physical dimensions of the grid are influenced by both the scales and the number of steps along each dimension, a side of the region is stepLength*(2*numberOfSteps[d]+1)*scaling[d].

Examples
SphinxExamples/src/Numerics/Optimizers/ExhaustiveOptimizer/Code.cxx.

Definition at line 78 of file itkExhaustiveOptimizerv4.h.

Member Typedef Documentation

◆ ConstPointer

template<typename TInternalComputationValueType >
using itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::ConstPointer = SmartPointer<const Self>

Definition at line 88 of file itkExhaustiveOptimizerv4.h.

◆ MeasureType

template<typename TInternalComputationValueType >
using itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::MeasureType = typename Superclass::MeasureType

Measure type

Definition at line 100 of file itkExhaustiveOptimizerv4.h.

◆ ParametersType

template<typename TInternalComputationValueType >
using itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::ParametersType = typename Superclass::ParametersType

Parameters type

Definition at line 103 of file itkExhaustiveOptimizerv4.h.

◆ Pointer

template<typename TInternalComputationValueType >
using itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::Pointer = SmartPointer<Self>

Definition at line 87 of file itkExhaustiveOptimizerv4.h.

◆ ScalesType

template<typename TInternalComputationValueType >
using itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::ScalesType = typename Superclass::ScalesType

Scales type

Definition at line 106 of file itkExhaustiveOptimizerv4.h.

◆ Self

template<typename TInternalComputationValueType >
using itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::Self = ExhaustiveOptimizerv4

Standard "Self" type alias.

Definition at line 85 of file itkExhaustiveOptimizerv4.h.

◆ StepsType

template<typename TInternalComputationValueType >
using itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::StepsType = Array<SizeValueType>

Steps type

Definition at line 97 of file itkExhaustiveOptimizerv4.h.

◆ Superclass

template<typename TInternalComputationValueType >
using itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::Superclass = ObjectToObjectOptimizerBaseTemplate<TInternalComputationValueType>

Definition at line 86 of file itkExhaustiveOptimizerv4.h.

Constructor & Destructor Documentation

◆ ExhaustiveOptimizerv4()

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

◆ ~ExhaustiveOptimizerv4()

template<typename TInternalComputationValueType >
itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::~ExhaustiveOptimizerv4 ( )
overrideprotecteddefault

Member Function Documentation

◆ AdvanceOneStep()

template<typename TInternalComputationValueType >
void itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::AdvanceOneStep ( )
protected

Advance to the next grid position.

◆ CreateAnother()

template<typename TInternalComputationValueType >
virtual::itk::LightObject::Pointer itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::CreateAnother ( ) const
virtual

Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.

Reimplemented from itk::Object.

◆ GetCurrentIndex()

template<typename TInternalComputationValueType >
virtual const ParametersType& itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::GetCurrentIndex ( ) const
virtual

◆ GetCurrentValue()

template<typename TInternalComputationValueType >
virtual const MeasureType& itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::GetCurrentValue ( ) const
virtual

◆ GetInitialPosition()

template<typename TInternalComputationValueType >
ParametersType& itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::GetInitialPosition ( )
inline

Get the position to initialize the optimization.

Definition at line 144 of file itkExhaustiveOptimizerv4.h.

◆ GetMaximumMetricValue()

template<typename TInternalComputationValueType >
virtual const MeasureType& itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::GetMaximumMetricValue ( ) const
virtual

◆ GetMaximumMetricValuePosition()

template<typename TInternalComputationValueType >
virtual const ParametersType& itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::GetMaximumMetricValuePosition ( ) const
virtual

◆ GetMinimumMetricValue()

template<typename TInternalComputationValueType >
virtual const MeasureType& itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::GetMinimumMetricValue ( ) const
virtual

◆ GetMinimumMetricValuePosition()

template<typename TInternalComputationValueType >
virtual const ParametersType& itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::GetMinimumMetricValuePosition ( ) const
virtual

◆ GetNameOfClass()

template<typename TInternalComputationValueType >
virtual const char* itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::GetNameOfClass ( ) const
virtual

Run-time type information (and related methods).

Reimplemented from itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >.

◆ GetNumberOfSteps()

template<typename TInternalComputationValueType >
virtual const StepsType& itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::GetNumberOfSteps ( ) const
virtual

◆ GetStepLength()

template<typename TInternalComputationValueType >
virtual const double& itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::GetStepLength ( ) const
virtual

◆ GetStopConditionDescription()

template<typename TInternalComputationValueType >
const std::string itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::GetStopConditionDescription ( ) const
overridevirtual

◆ IncrementIndex()

template<typename TInternalComputationValueType >
void itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::IncrementIndex ( ParametersType param)
protected

◆ New()

template<typename TInternalComputationValueType >
static Pointer itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::New ( )
static

Method for creation through the object factory.

◆ PrintSelf()

template<typename TInternalComputationValueType >
void itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::PrintSelf ( std::ostream &  os,
Indent  indent 
) const
overrideprotectedvirtual

Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from itk::Object.

◆ ResumeWalking()

template<typename TInternalComputationValueType >
void itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::ResumeWalking ( )

Resume the optimization

◆ SetInitialPosition()

template<typename TInternalComputationValueType >
void itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::SetInitialPosition ( const ParametersType param)

Set the position to initialize the optimization.

◆ SetNumberOfSteps()

template<typename TInternalComputationValueType >
virtual void itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::SetNumberOfSteps ( StepsType  _arg)
virtual

◆ SetStepLength()

template<typename TInternalComputationValueType >
virtual void itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::SetStepLength ( double  _arg)
virtual

◆ StartOptimization()

template<typename TInternalComputationValueType >
void itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::StartOptimization ( bool  doOnlyInitialization = false)
overridevirtual

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 from itk::ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType >.

◆ StartWalking()

template<typename TInternalComputationValueType >
void itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::StartWalking ( )

Start optimization

◆ StopWalking()

template<typename TInternalComputationValueType >
void itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::StopWalking ( )

Stop optimization

Member Data Documentation

◆ m_CurrentIndex

template<typename TInternalComputationValueType >
ParametersType itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::m_CurrentIndex
protected

Definition at line 168 of file itkExhaustiveOptimizerv4.h.

◆ m_CurrentValue

template<typename TInternalComputationValueType >
MeasureType itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::m_CurrentValue
protected

Definition at line 164 of file itkExhaustiveOptimizerv4.h.

◆ m_InitialPosition

template<typename TInternalComputationValueType >
ParametersType itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::m_InitialPosition
protected

Definition at line 163 of file itkExhaustiveOptimizerv4.h.

◆ m_MaximumMetricValue

template<typename TInternalComputationValueType >
MeasureType itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::m_MaximumMetricValue
protected

Definition at line 169 of file itkExhaustiveOptimizerv4.h.

◆ m_MaximumMetricValuePosition

template<typename TInternalComputationValueType >
ParametersType itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::m_MaximumMetricValuePosition
protected

Definition at line 172 of file itkExhaustiveOptimizerv4.h.

◆ m_MinimumMetricValue

template<typename TInternalComputationValueType >
MeasureType itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::m_MinimumMetricValue
protected

Definition at line 170 of file itkExhaustiveOptimizerv4.h.

◆ m_MinimumMetricValuePosition

template<typename TInternalComputationValueType >
ParametersType itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::m_MinimumMetricValuePosition
protected

Definition at line 171 of file itkExhaustiveOptimizerv4.h.

◆ m_NumberOfSteps

template<typename TInternalComputationValueType >
StepsType itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::m_NumberOfSteps
protected

Definition at line 165 of file itkExhaustiveOptimizerv4.h.

◆ m_StepLength

template<typename TInternalComputationValueType >
double itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::m_StepLength { 1.0 }
protected

Definition at line 167 of file itkExhaustiveOptimizerv4.h.

◆ m_Stop

template<typename TInternalComputationValueType >
bool itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::m_Stop { false }
protected

Definition at line 166 of file itkExhaustiveOptimizerv4.h.

◆ m_StopConditionDescription

template<typename TInternalComputationValueType >
std::ostringstream itk::ExhaustiveOptimizerv4< TInternalComputationValueType >::m_StopConditionDescription
private

Definition at line 175 of file itkExhaustiveOptimizerv4.h.


The documentation for this class was generated from the following file:
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50