ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkAmoebaOptimizer.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 __itkAmoebaOptimizer_h
19 #define __itkAmoebaOptimizer_h
20 
22 #include "vnl/algo/vnl_amoeba.h"
23 
24 namespace itk
25 {
61 class ITK_EXPORT AmoebaOptimizer:
63 {
64 public:
70  typedef unsigned int NumberOfIterationsType;
71 
73  itkNewMacro(Self);
74 
77 
80  typedef Superclass::ParametersType ParametersType;
81 
84 
86  void StartOptimization(void);
87 
89  virtual void SetCostFunction(SingleValuedCostFunction *costFunction);
90 
94  itkSetMacro( MaximumNumberOfIterations, NumberOfIterationsType );
95  itkGetConstMacro( MaximumNumberOfIterations, NumberOfIterationsType );
97 
106  itkSetMacro(AutomaticInitialSimplex, bool);
107  itkBooleanMacro(AutomaticInitialSimplex);
108  itkGetConstMacro(AutomaticInitialSimplex, bool);
110 
117  itkSetMacro(OptimizeWithRestarts, bool);
118  itkBooleanMacro(OptimizeWithRestarts);
119  itkGetConstMacro(OptimizeWithRestarts, bool);
121 
124  void SetInitialSimplexDelta(ParametersType initialSimplexDelta,
125  bool automaticInitialSimplex = false);
126  itkGetConstMacro(InitialSimplexDelta, ParametersType);
128 
133  itkSetMacro(ParametersConvergenceTolerance, double);
134  itkGetConstMacro(ParametersConvergenceTolerance, double);
136 
141  itkSetMacro(FunctionConvergenceTolerance, double);
142  itkGetConstMacro(FunctionConvergenceTolerance, double);
144 
146  const std::string GetStopConditionDescription() const;
147 
149  MeasureType GetValue() const;
150 
152  vnl_amoeba * GetOptimizer(void) const;
153 
154 protected:
155  AmoebaOptimizer();
156  virtual ~AmoebaOptimizer();
157  void PrintSelf(std::ostream & os, Indent indent) const;
158 
159  typedef Superclass::CostFunctionAdaptorType CostFunctionAdaptorType;
160 private:
162  void ValidateSettings();
163  //purposely not implemented
164  AmoebaOptimizer(const Self &);
165  //purposely not implemented
166  void operator=(const Self &);
168 
170  ParametersType::ValueType m_ParametersConvergenceTolerance;
171  CostFunctionType::MeasureType m_FunctionConvergenceTolerance;
175  vnl_amoeba * m_VnlOptimizer;
176 
177  std::ostringstream m_StopConditionDescription;
178 };
179 } // end namespace itk
180 
181 #endif
182