18#ifndef itkRegularStepGradientDescentBaseOptimizer_h
19#define itkRegularStepGradientDescentBaseOptimizer_h
23#include "ITKOptimizersExport.h"
40 GradientMagnitudeTolerance = 1,
42 ImageNotAvailable = 3,
43 CostFunctionError = 4,
44 MaximumNumberOfIterations = 5,
49extern ITKOptimizers_EXPORT std::ostream &
76#if !defined(ITK_LEGACY_REMOVE)
79 static constexpr StopConditionEnum GradientMagnitudeTolerance = StopConditionEnum::GradientMagnitudeTolerance;
80 static constexpr StopConditionEnum StepTooSmall = StopConditionEnum::StepTooSmall;
81 static constexpr StopConditionEnum ImageNotAvailable = StopConditionEnum::ImageNotAvailable;
82 static constexpr StopConditionEnum CostFunctionError = StopConditionEnum::CostFunctionError;
83 static constexpr StopConditionEnum MaximumNumberOfIterations = StopConditionEnum::MaximumNumberOfIterations;
87 itkSetMacro(Maximize,
bool);
88 itkGetConstReferenceMacro(Maximize,
bool);
89 itkBooleanMacro(Maximize);
98 this->SetMaximize(!v);
127 itkSetMacro(MaximumStepLength,
double);
128 itkSetMacro(MinimumStepLength,
double);
129 itkSetMacro(RelaxationFactor,
double);
131 itkSetMacro(GradientMagnitudeTolerance,
double);
132 itkGetConstReferenceMacro(CurrentStepLength,
double);
133 itkGetConstReferenceMacro(MaximumStepLength,
double);
134 itkGetConstReferenceMacro(MinimumStepLength,
double);
135 itkGetConstReferenceMacro(RelaxationFactor,
double);
137 itkGetConstReferenceMacro(GradientMagnitudeTolerance,
double);
138 itkGetConstMacro(CurrentIteration,
unsigned int);
170 ex.SetLocation(__FILE__);
171 ex.SetDescription(
"This method MUST be overloaded in derived classes");
180 bool m_Stop{
false };
183 double m_GradientMagnitudeTolerance{};
184 double m_MaximumStepLength{};
185 double m_MinimumStepLength{};
186 double m_CurrentStepLength{};
187 double m_RelaxationFactor{};
191 std::ostringstream m_StopConditionDescription{};
Array class with size defined at construction time.
Control indentation during Print() invocation.
Light weight base class for most itk classes.
Contains all enum classes for RegularStepGradientDescentBaseOptimizer class.
Implement a gradient descent optimizer.
void ResumeOptimization()
virtual void AdvanceOneStep()
void PrintSelf(std::ostream &os, Indent indent) const override
virtual void StepAlongGradient(double, const DerivativeType &)
void StartOptimization() override
RegularStepGradientDescentBaseOptimizer()
std::string GetStopConditionDescription() const override
~RegularStepGradientDescentBaseOptimizer() override=default
This class is a base for the Optimization methods that optimize a single valued function.
CostFunctionType::MeasureType MeasureType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)
unsigned long SizeValueType