ITK  6.0.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
26namespace itk
27{
62class ITKOptimizersv4_EXPORT AmoebaOptimizerv4 : public SingleValuedNonLinearVnlOptimizerv4
63{
64public:
65 ITK_DISALLOW_COPY_AND_MOVE(AmoebaOptimizerv4);
66
72
74 itkNewMacro(Self);
75
77 itkOverrideGetNameOfClassMacro(AmoebaOptimizerv4);
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
144
146 vnl_amoeba *
148
149protected:
152 void
153 PrintSelf(std::ostream & os, Indent indent) const override;
154
155 using CostFunctionAdaptorType = Superclass::CostFunctionAdaptorType;
156
157private:
159 void
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
Wrap of the vnl_amoeba algorithm.
Superclass::CostFunctionAdaptorType CostFunctionAdaptorType
void PrintSelf(std::ostream &os, Indent indent) const override
~AmoebaOptimizerv4() override
void SetInitialSimplexDelta(ParametersType initialSimplexDelta, bool automaticInitialSimplex=false)
vnl_amoeba * GetOptimizer() const
std::unique_ptr< vnl_amoeba > m_VnlOptimizer
vnl_vector< double > InternalParametersType
const std::string GetStopConditionDescription() const override
void SetMetric(MetricType *metric) override
void StartOptimization(bool doOnlyInitialization=false) override
Superclass::ParametersType ParametersType
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
This is a base for the ITKv4 Optimization methods using the vnl library.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....