ITK  5.4.0
Insight Toolkit
itkLevenbergMarquardtOptimizer.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * https://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkLevenbergMarquardtOptimizer_h
19 #define itkLevenbergMarquardtOptimizer_h
20 
22 #include "vnl/algo/vnl_levenberg_marquardt.h"
23 #include "ITKOptimizersExport.h"
24 #include <memory> // For unique_ptr.
25 
26 namespace itk
27 {
39 {
40 public:
41  ITK_DISALLOW_COPY_AND_MOVE(LevenbergMarquardtOptimizer);
42 
48 
50  itkNewMacro(Self);
51 
53  itkOverrideGetNameOfClassMacro(LevenbergMarquardtOptimizer);
54 
56  using InternalParametersType = vnl_vector<double>;
57 
59  using InternalOptimizerType = vnl_levenberg_marquardt;
60 
62  vnl_levenberg_marquardt *
63  GetOptimizer() const;
64 
66  void
67  StartOptimization() override;
68 
70  void
71  SetCostFunction(MultipleValuedCostFunction * costFunction) override;
72 
73  void
74  SetNumberOfIterations(unsigned int iterations);
75 
76  void
77  SetValueTolerance(double tol);
78 
79  void
80  SetGradientTolerance(double tol);
81 
82  void
83  SetEpsilonFunction(double epsilon);
84 
87  GetValue() const;
88 
89  const std::string
90  GetStopConditionDescription() const override;
91 
92 protected:
94  ~LevenbergMarquardtOptimizer() override;
95 
96  using CostFunctionAdaptorType = Superclass::CostFunctionAdaptorType;
97 
98 private:
99  bool m_OptimizerInitialized{};
100  std::unique_ptr<InternalOptimizerType> m_VnlOptimizer;
101  unsigned int m_NumberOfIterations{};
102  double m_ValueTolerance{};
103  double m_GradientTolerance{};
104  double m_EpsilonFunction{};
105 };
106 } // end namespace itk
107 
108 #endif
itk::MultipleValuedCostFunction
This class is a base for the CostFunctions returning a multiple values.
Definition: itkMultipleValuedCostFunction.h:35
itk::LevenbergMarquardtOptimizer::m_VnlOptimizer
std::unique_ptr< InternalOptimizerType > m_VnlOptimizer
Definition: itkLevenbergMarquardtOptimizer.h:100
itk::SmartPointer< Self >
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itkMultipleValuedNonLinearVnlOptimizer.h
itk::LevenbergMarquardtOptimizer::CostFunctionAdaptorType
Superclass::CostFunctionAdaptorType CostFunctionAdaptorType
Definition: itkLevenbergMarquardtOptimizer.h:96
itk::LevenbergMarquardtOptimizer::InternalParametersType
vnl_vector< double > InternalParametersType
Definition: itkLevenbergMarquardtOptimizer.h:56
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::LevenbergMarquardtOptimizer::InternalOptimizerType
vnl_levenberg_marquardt InternalOptimizerType
Definition: itkLevenbergMarquardtOptimizer.h:59
itk::Array< double >
itk::MultipleValuedNonLinearVnlOptimizer
This class is a base for the Optimization methods that optimize a multi-valued function.
Definition: itkMultipleValuedNonLinearVnlOptimizer.h:37
itk::LevenbergMarquardtOptimizer
Wrap of the vnl_levenberg_marquardt algorithm.
Definition: itkLevenbergMarquardtOptimizer.h:38