ITK  4.3.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 
161 private:
163  void ValidateSettings();
164  //purposely not implemented
165  AmoebaOptimizer(const Self &);
166  //purposely not implemented
167  void operator=(const Self &);
169 
171  ParametersType::ValueType m_ParametersConvergenceTolerance;
172  CostFunctionType::MeasureType m_FunctionConvergenceTolerance;
176  vnl_amoeba * m_VnlOptimizer;
177 
178  std::ostringstream m_StopConditionDescription;
179 };
180 } // end namespace itk
181 
182 #endif
183