ITK  5.2.0
Insight Toolkit
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType > Class Template Reference

#include <itkLBFGSOptimizerBasev4.h>

+ Inheritance diagram for itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >:
+ Collaboration diagram for itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >:

Public Types

using ConstPointer = SmartPointer< const Self >
 
using InternalOptimizerType = LBFGSOptimizerBaseHelperv4< TInternalVnlOptimizerType >
 
using MetricType = Superclass::MetricType
 
using ParametersType = Superclass::ParametersType
 
using Pointer = SmartPointer< Self >
 
using ScalesType = Superclass::ScalesType
 
using Self = LBFGSOptimizerBasev4
 
using StopConditionDescriptionType = Superclass::StopConditionDescriptionType
 
using StopConditionReturnStringType = Superclass::StopConditionReturnStringType
 
using Superclass = SingleValuedNonLinearVnlOptimizerv4
 
- Public Types inherited from itk::SingleValuedNonLinearVnlOptimizerv4
using CommandType = ReceptorMemberCommand< Self >
 
using ConstPointer = SmartPointer< const Self >
 
using DerivativeType = Superclass::DerivativeType
 
using MetricType = Superclass::MetricType
 
using ParametersType = Superclass::ParametersType
 
using Pointer = SmartPointer< Self >
 
using ScalesType = Superclass::ScalesType
 
using Self = SingleValuedNonLinearVnlOptimizerv4
 
using StopConditionDescriptionType = Superclass::StopConditionDescriptionType
 
using StopConditionReturnStringType = Superclass::StopConditionReturnStringType
 
using Superclass = ObjectToObjectOptimizerBase
 
- Public Types inherited from itk::ObjectToObjectOptimizerBaseTemplate< double >
using ConstPointer = SmartPointer< const Self >
 
using DerivativeType = typename MetricType::DerivativeType
 
using MeasureType = typename MetricType::MeasureType
 
using MetricType = ObjectToObjectMetricBaseTemplate< double >
 
using MetricTypePointer = typename MetricType::Pointer
 
using NumberOfParametersType = typename MetricType::NumberOfParametersType
 
using ParametersType = OptimizerParameters< double >
 
using Pointer = SmartPointer< Self >
 
using ScalesEstimatorType = OptimizerParameterScalesEstimatorTemplate< double >
 
using ScalesType = OptimizerParameters< double >
 
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 double GetGradientConvergenceTolerance () const
 
virtual unsigned int GetMaximumNumberOfFunctionEvaluations () const
 
virtual const char * GetNameOfClass () const
 
InternalOptimizerTypeGetOptimizer ()
 
const StopConditionReturnStringType GetStopConditionDescription () const override
 
virtual bool GetTrace () const
 
virtual void SetGradientConvergenceTolerance (double f)
 
virtual void SetMaximumNumberOfFunctionEvaluations (unsigned int n)
 
void SetMetric (MetricType *metric) override
 
virtual void SetTrace (bool flag)
 
void StartOptimization (bool doOnlyInitialization=false) override
 
virtual void TraceOff ()
 
virtual void TraceOn ()
 
- Public Member Functions inherited from itk::SingleValuedNonLinearVnlOptimizerv4
void StartOptimization (bool doOnlyInitialization=false) override
 
virtual const DerivativeTypeGetCachedDerivative () const
 
virtual const ParametersTypeGetCachedCurrentPosition () const
 
- Public Member Functions inherited from itk::ObjectToObjectOptimizerBaseTemplate< double >
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
 
unsigned long AddObserver (const EventObject &event, std::function< void(const EventObject &)> function) const
 
LightObject::Pointer CreateAnother () const override
 
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
Pointer Clone () const
 
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
void Print (std::ostream &os, Indent indent=0) const
 

Protected Types

using CostFunctionAdaptorType = Superclass::CostFunctionAdaptorType
 
using InternalOptimizerAutoPointer = std::unique_ptr< InternalOptimizerType >
 
- Protected Types inherited from itk::SingleValuedNonLinearVnlOptimizerv4
using CostFunctionAdaptorType = SingleValuedVnlCostFunctionAdaptorv4
 

Protected Member Functions

 LBFGSOptimizerBasev4 ()
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
 ~LBFGSOptimizerBasev4 () override=default
 
- Protected Member Functions inherited from itk::SingleValuedNonLinearVnlOptimizerv4
 SingleValuedNonLinearVnlOptimizerv4 ()
 
 ~SingleValuedNonLinearVnlOptimizerv4 () override
 
void SetCostFunctionAdaptor (CostFunctionAdaptorType *adaptor)
 
const CostFunctionAdaptorTypeGetCostFunctionAdaptor () const
 
CostFunctionAdaptorTypeGetCostFunctionAdaptor ()
 
CostFunctionAdaptorTypeGetNonConstCostFunctionAdaptor () const
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
- Protected Member Functions inherited from itk::ObjectToObjectOptimizerBaseTemplate< double >
 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 &timeStamp)
 
- 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

double m_CostFunctionConvergenceFactor { 1e+7 }
 
double m_GradientConvergenceTolerance { 1e-5 }
 
double m_InfinityNormOfProjectedGradient { 0.0 }
 
unsigned int m_MaximumNumberOfFunctionEvaluations { 2000 }
 
bool m_OptimizerInitialized { false }
 
std::ostringstream m_StopConditionDescription
 
bool m_Trace { false }
 
InternalOptimizerAutoPointer m_VnlOptimizer
 
- Protected Attributes inherited from itk::ObjectToObjectOptimizerBaseTemplate< double >
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
 

Friends

class LBFGSBOptimizerHelperv4
 
class LBFGSOptimizerBaseHelperv4< TInternalVnlOptimizerType >
 

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 val)
 
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 

Detailed Description

template<typename TInternalVnlOptimizerType>
class itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >

Abstract base for vnl lbfgs algorithm optimizers in ITKv4 registration framework.

Note
The StopConditionDescription returned by this class is directly from the vnl optimizer by calling m_VnlOptimizer->get_failure_code() . This seems to return "Failure" even when no error has occurred. The same behavior is observed in the ITKv3 version of this optimizer.
Local-support (high-density) transforms. Local-support transforms are not supported. To add support for these, the class must be modified thusly:
1) Parameter updates: In SingleValuedNonLinearCostFunctionAdaptor, the handling of the gradient must be changed to accommodate the fact that local-support transforms expect a gradient to be added to the transform parameters using the UpdateTransformParameters method of the local support transform. Other optimizers in the v4 framework use this method, but the use of the vnl optimizers here complicates it.
2) Efficiency To work efficiently with local-support transforms, this class should be modified to use a single parameter object to avoid the multiple parameter copies that are currently performed. It should work to use the transform parameters pointer.

This code has been adapted for the ITKv4 registration framework from the v3 version, itkLBFGSOptimizer.

Definition at line 76 of file itkLBFGSOptimizerBasev4.h.

Member Typedef Documentation

◆ ConstPointer

template<typename TInternalVnlOptimizerType>
using itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::ConstPointer = SmartPointer<const Self>

Definition at line 85 of file itkLBFGSOptimizerBasev4.h.

◆ CostFunctionAdaptorType

template<typename TInternalVnlOptimizerType>
using itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::CostFunctionAdaptorType = Superclass::CostFunctionAdaptorType
protected

Definition at line 150 of file itkLBFGSOptimizerBasev4.h.

◆ InternalOptimizerAutoPointer

template<typename TInternalVnlOptimizerType>
using itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::InternalOptimizerAutoPointer = std::unique_ptr<InternalOptimizerType>
protected

Definition at line 154 of file itkLBFGSOptimizerBasev4.h.

◆ InternalOptimizerType

template<typename TInternalVnlOptimizerType>
using itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::InternalOptimizerType = LBFGSOptimizerBaseHelperv4<TInternalVnlOptimizerType>

The vnl optimizer

Definition at line 101 of file itkLBFGSOptimizerBasev4.h.

◆ MetricType

template<typename TInternalVnlOptimizerType>
using itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::MetricType = Superclass::MetricType

Definition at line 90 of file itkLBFGSOptimizerBasev4.h.

◆ ParametersType

template<typename TInternalVnlOptimizerType>
using itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::ParametersType = Superclass::ParametersType

Definition at line 91 of file itkLBFGSOptimizerBasev4.h.

◆ Pointer

template<typename TInternalVnlOptimizerType>
using itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::Pointer = SmartPointer<Self>

Definition at line 84 of file itkLBFGSOptimizerBasev4.h.

◆ ScalesType

template<typename TInternalVnlOptimizerType>
using itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::ScalesType = Superclass::ScalesType

Definition at line 92 of file itkLBFGSOptimizerBasev4.h.

◆ Self

template<typename TInternalVnlOptimizerType>
using itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::Self = LBFGSOptimizerBasev4

Standard "Self" type alias.

Definition at line 82 of file itkLBFGSOptimizerBasev4.h.

◆ StopConditionDescriptionType

template<typename TInternalVnlOptimizerType>
using itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::StopConditionDescriptionType = Superclass::StopConditionDescriptionType

Stop condition internal string type

Definition at line 98 of file itkLBFGSOptimizerBasev4.h.

◆ StopConditionReturnStringType

template<typename TInternalVnlOptimizerType>
using itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::StopConditionReturnStringType = Superclass::StopConditionReturnStringType

Stop condition return string type

Definition at line 95 of file itkLBFGSOptimizerBasev4.h.

◆ Superclass

template<typename TInternalVnlOptimizerType>
using itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::Superclass = SingleValuedNonLinearVnlOptimizerv4

Definition at line 83 of file itkLBFGSOptimizerBasev4.h.

Constructor & Destructor Documentation

◆ LBFGSOptimizerBasev4()

template<typename TInternalVnlOptimizerType>
itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::LBFGSOptimizerBasev4 ( )
protected

◆ ~LBFGSOptimizerBasev4()

template<typename TInternalVnlOptimizerType>
itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::~LBFGSOptimizerBasev4 ( )
overrideprotecteddefault

Member Function Documentation

◆ GetGradientConvergenceTolerance()

template<typename TInternalVnlOptimizerType>
virtual double itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::GetGradientConvergenceTolerance ( ) const
virtual

◆ GetMaximumNumberOfFunctionEvaluations()

template<typename TInternalVnlOptimizerType>
virtual unsigned int itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::GetMaximumNumberOfFunctionEvaluations ( ) const
virtual

◆ GetNameOfClass()

template<typename TInternalVnlOptimizerType>
virtual const char* itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::GetNameOfClass ( ) const
virtual

Run-time type information (and related methods).

Reimplemented from itk::SingleValuedNonLinearVnlOptimizerv4.

Reimplemented in itk::LBFGSOptimizerv4, and itk::LBFGSBOptimizerv4.

◆ GetOptimizer()

template<typename TInternalVnlOptimizerType>
InternalOptimizerType* itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::GetOptimizer ( )

Method for getting access to the internal optimizer.

◆ GetStopConditionDescription()

template<typename TInternalVnlOptimizerType>
const StopConditionReturnStringType itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::GetStopConditionDescription ( ) const
overridevirtual

Get the reason for termination

Implements itk::SingleValuedNonLinearVnlOptimizerv4.

◆ GetTrace()

template<typename TInternalVnlOptimizerType>
virtual bool itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::GetTrace ( ) const
virtual

◆ PrintSelf()

template<typename TInternalVnlOptimizerType>
void itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::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.

◆ SetGradientConvergenceTolerance()

template<typename TInternalVnlOptimizerType>
virtual void itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::SetGradientConvergenceTolerance ( double  f)
virtual

Set/Get the gradient convergence tolerance. This is a positive real number that determines the accuracy with which the solution is to be found. The optimization terminates when: ||G|| < gtol max(1,||X||) where ||.|| denotes the Euclidean norm.

◆ SetMaximumNumberOfFunctionEvaluations()

template<typename TInternalVnlOptimizerType>
virtual void itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::SetMaximumNumberOfFunctionEvaluations ( unsigned int  n)
virtual

Set/Get the maximum number of function evaluations allowed.

◆ SetMetric()

template<typename TInternalVnlOptimizerType>
void itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::SetMetric ( MetricType metric)
overridevirtual

Plug in a Cost Function into the optimizer

Implements itk::SingleValuedNonLinearVnlOptimizerv4.

◆ SetTrace()

template<typename TInternalVnlOptimizerType>
virtual void itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::SetTrace ( bool  flag)
virtual

Set/Get the optimizer trace flag. If set to true, the optimizer prints out information every iteration.

◆ StartOptimization()

template<typename TInternalVnlOptimizerType>
void itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::StartOptimization ( bool  doOnlyInitialization = false)
overridevirtual

Start optimization with an initial value.

Reimplemented from itk::ObjectToObjectOptimizerBaseTemplate< double >.

◆ TraceOff()

template<typename TInternalVnlOptimizerType>
virtual void itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::TraceOff ( )
virtual

◆ TraceOn()

template<typename TInternalVnlOptimizerType>
virtual void itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::TraceOn ( )
virtual

Friends And Related Function Documentation

◆ LBFGSBOptimizerHelperv4

template<typename TInternalVnlOptimizerType>
friend class LBFGSBOptimizerHelperv4
friend

Definition at line 168 of file itkLBFGSOptimizerBasev4.h.

◆ LBFGSOptimizerBaseHelperv4< TInternalVnlOptimizerType >

template<typename TInternalVnlOptimizerType>
friend class LBFGSOptimizerBaseHelperv4< TInternalVnlOptimizerType >
friend

Definition at line 167 of file itkLBFGSOptimizerBasev4.h.

Member Data Documentation

◆ m_CostFunctionConvergenceFactor

template<typename TInternalVnlOptimizerType>
double itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::m_CostFunctionConvergenceFactor { 1e+7 }
protected

Definition at line 163 of file itkLBFGSOptimizerBasev4.h.

◆ m_GradientConvergenceTolerance

template<typename TInternalVnlOptimizerType>
double itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::m_GradientConvergenceTolerance { 1e-5 }
protected

Definition at line 161 of file itkLBFGSOptimizerBasev4.h.

◆ m_InfinityNormOfProjectedGradient

template<typename TInternalVnlOptimizerType>
double itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::m_InfinityNormOfProjectedGradient { 0.0 }
protected

Definition at line 162 of file itkLBFGSOptimizerBasev4.h.

◆ m_MaximumNumberOfFunctionEvaluations

template<typename TInternalVnlOptimizerType>
unsigned int itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::m_MaximumNumberOfFunctionEvaluations { 2000 }
protected

Definition at line 160 of file itkLBFGSOptimizerBasev4.h.

◆ m_OptimizerInitialized

template<typename TInternalVnlOptimizerType>
bool itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::m_OptimizerInitialized { false }
protected

Definition at line 152 of file itkLBFGSOptimizerBasev4.h.

◆ m_StopConditionDescription

template<typename TInternalVnlOptimizerType>
std::ostringstream itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::m_StopConditionDescription
mutableprotected

Definition at line 157 of file itkLBFGSOptimizerBasev4.h.

◆ m_Trace

template<typename TInternalVnlOptimizerType>
bool itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::m_Trace { false }
protected

Definition at line 159 of file itkLBFGSOptimizerBasev4.h.

◆ m_VnlOptimizer

template<typename TInternalVnlOptimizerType>
InternalOptimizerAutoPointer itk::LBFGSOptimizerBasev4< TInternalVnlOptimizerType >::m_VnlOptimizer
protected

Definition at line 155 of file itkLBFGSOptimizerBasev4.h.


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