ITK  5.4.0
Insight Toolkit
itkAmoebaOptimizerv4.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 itkAmoebaOptimizerv4_h
19 #define itkAmoebaOptimizerv4_h
20 
22 #include "vnl/algo/vnl_amoeba.h"
23 #include "ITKOptimizersv4Export.h"
24 #include <memory> // For unique_ptr.
25 
26 namespace itk
27 {
62 class ITKOptimizersv4_EXPORT AmoebaOptimizerv4 : public SingleValuedNonLinearVnlOptimizerv4
63 {
64 public:
65  ITK_DISALLOW_COPY_AND_MOVE(AmoebaOptimizerv4);
66 
72 
74  itkNewMacro(Self);
75 
78 
82 
84  using InternalParametersType = vnl_vector<double>;
85 
87  void
88  StartOptimization(bool doOnlyInitialization = false) override;
89 
91  void
92  SetMetric(MetricType * metric) override;
93 
102  itkSetMacro(AutomaticInitialSimplex, bool);
103  itkBooleanMacro(AutomaticInitialSimplex);
104  itkGetConstMacro(AutomaticInitialSimplex, bool);
113  itkSetMacro(OptimizeWithRestarts, bool);
114  itkBooleanMacro(OptimizeWithRestarts);
115  itkGetConstMacro(OptimizeWithRestarts, bool);
120  void
121  SetInitialSimplexDelta(ParametersType initialSimplexDelta, bool automaticInitialSimplex = false);
122  itkGetConstMacro(InitialSimplexDelta, ParametersType);
129  itkSetMacro(ParametersConvergenceTolerance, double);
130  itkGetConstMacro(ParametersConvergenceTolerance, double);
137  itkSetMacro(FunctionConvergenceTolerance, double);
138  itkGetConstMacro(FunctionConvergenceTolerance, double);
142  const std::string
143  GetStopConditionDescription() const override;
144 
146  vnl_amoeba *
147  GetOptimizer() const;
148 
149 protected:
151  ~AmoebaOptimizerv4() override;
152  void
153  PrintSelf(std::ostream & os, Indent indent) const override;
154 
155  using CostFunctionAdaptorType = Superclass::CostFunctionAdaptorType;
156 
157 private:
159  void
160  ValidateSettings();
161 
162  ParametersType::ValueType m_ParametersConvergenceTolerance{};
163  MeasureType m_FunctionConvergenceTolerance{};
164  bool m_AutomaticInitialSimplex{};
165  ParametersType m_InitialSimplexDelta{};
166  bool m_OptimizeWithRestarts{};
167  std::unique_ptr<vnl_amoeba> m_VnlOptimizer;
168 
169  std::ostringstream m_StopConditionDescription{};
170 };
171 } // end namespace itk
172 
173 #endif
itk::AmoebaOptimizerv4::InternalParametersType
vnl_vector< double > InternalParametersType
Definition: itkAmoebaOptimizerv4.h:84
itk::SingleValuedNonLinearVnlOptimizerv4::MetricType
Superclass::MetricType MetricType
Definition: itkSingleValuedNonLinearVnlOptimizerv4.h:58
itk::AmoebaOptimizerv4::ParametersType
Superclass::ParametersType ParametersType
Definition: itkAmoebaOptimizerv4.h:81
itkSingleValuedNonLinearVnlOptimizerv4.h
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::SingleValuedNonLinearVnlOptimizerv4
This is a base for the ITKv4 Optimization methods using the vnl library.
Definition: itkSingleValuedNonLinearVnlOptimizerv4.h:38
itk::AmoebaOptimizerv4::m_VnlOptimizer
std::unique_ptr< vnl_amoeba > m_VnlOptimizer
Definition: itkAmoebaOptimizerv4.h:167
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itkOverrideGetNameOfClassMacro
itkOverrideGetNameOfClassMacro(AddImageFilter)
itk::AmoebaOptimizerv4
Wrap of the vnl_amoeba algorithm.
Definition: itkAmoebaOptimizerv4.h:62
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::SingleValuedNonLinearVnlOptimizerv4::ParametersType
Superclass::ParametersType ParametersType
Definition: itkSingleValuedNonLinearVnlOptimizerv4.h:60
itk::AmoebaOptimizerv4::CostFunctionAdaptorType
Superclass::CostFunctionAdaptorType CostFunctionAdaptorType
Definition: itkAmoebaOptimizerv4.h:155