ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkAmoebaOptimizerv4.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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  * http://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 
25 namespace itk
26 {
60 class ITKOptimizersv4_EXPORT AmoebaOptimizerv4:
62 {
63 public:
64  ITK_DISALLOW_COPY_AND_ASSIGN(AmoebaOptimizerv4);
65 
71 
73  itkNewMacro(Self);
74 
77 
81 
83  using InternalParametersType = vnl_vector< double >;
84 
86  void StartOptimization(bool doOnlyInitialization = false) override;
87 
89  void SetMetric(MetricType *metric) override;
90 
99  itkSetMacro(AutomaticInitialSimplex, bool);
100  itkBooleanMacro(AutomaticInitialSimplex);
101  itkGetConstMacro(AutomaticInitialSimplex, bool);
103 
110  itkSetMacro(OptimizeWithRestarts, bool);
111  itkBooleanMacro(OptimizeWithRestarts);
112  itkGetConstMacro(OptimizeWithRestarts, bool);
114 
117  void SetInitialSimplexDelta(ParametersType initialSimplexDelta,
118  bool automaticInitialSimplex = false);
119  itkGetConstMacro(InitialSimplexDelta, ParametersType);
121 
126  itkSetMacro(ParametersConvergenceTolerance, double);
127  itkGetConstMacro(ParametersConvergenceTolerance, double);
129 
134  itkSetMacro(FunctionConvergenceTolerance, double);
135  itkGetConstMacro(FunctionConvergenceTolerance, double);
137 
139  const std::string GetStopConditionDescription() const override;
140 
142  vnl_amoeba * GetOptimizer() const;
143 
144 protected:
146  ~AmoebaOptimizerv4() override;
147  void PrintSelf(std::ostream & os, Indent indent) const override;
148 
149  using CostFunctionAdaptorType = Superclass::CostFunctionAdaptorType;
150 
151 private:
153  void ValidateSettings();
154 
155  ParametersType::ValueType m_ParametersConvergenceTolerance;
160  vnl_amoeba * m_VnlOptimizer;
161 
162  std::ostringstream m_StopConditionDescription;
163 };
164 } // end namespace itk
165 
166 #endif
Light weight base class for most itk classes.
ParametersType::ValueType m_ParametersConvergenceTolerance
std::ostringstream m_StopConditionDescription
MeasureType m_FunctionConvergenceTolerance
Superclass::ParametersType ParametersType
This is a base for the ITKv4 Optimization methods using the vnl library.
Wrap of the vnl_amoeba algorithm.
vnl_vector< double > InternalParametersType
ParametersType m_InitialSimplexDelta
Superclass::CostFunctionAdaptorType CostFunctionAdaptorType
Control indentation during Print() invocation.
Definition: itkIndent.h:49