ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkOptimizer.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 itkOptimizer_h
19 #define itkOptimizer_h
20 
21 #include "itkObject.h"
22 #include "itkObjectFactory.h"
23 #include "itkArray.h"
24 #include "itkOptimizerParameters.h"
25 #include "ITKOptimizersExport.h"
26 
27 namespace itk
28 {
38 class ITKOptimizers_EXPORT Optimizer:public Object
39 {
40 public:
42  typedef Optimizer Self;
43  typedef Object Superclass;
46 
48  itkNewMacro(Self);
49 
51  itkTypeMacro(Optimizer, Object);
52 
56 
64 
66  virtual void SetInitialPosition(const ParametersType & param);
67 
69  itkGetConstReferenceMacro(InitialPosition, ParametersType);
70 
72  void SetScales(const ScalesType & scales);
73 
75  itkGetConstReferenceMacro(Scales, ScalesType);
76  itkGetConstReferenceMacro(InverseScales, ScalesType);
78 
80  itkGetConstReferenceMacro(CurrentPosition, ParametersType);
81 
83  virtual void StartOptimization() {}
84 
86  virtual const std::string GetStopConditionDescription() const;
87 
88 protected:
89  Optimizer();
90  virtual ~Optimizer() {}
91  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
92 
94  virtual void SetCurrentPosition(const ParametersType & param);
95 
97 
98  // Keep m_CurrentPosition as a protected var so that subclasses can
99  // have fast access. This is important when optimizing high-dimensional
100  // spaces, e.g. bspline transforms.
102 
103 private:
104  Optimizer(const Self &) ITK_DELETE_FUNCTION;
105  void operator=(const Self &) ITK_DELETE_FUNCTION;
106 
107  ParametersType m_InitialPosition;
108  ScalesType m_Scales;
109  ScalesType m_InverseScales;
110 };
111 } // end namespace itk
112 
113 #endif
Light weight base class for most itk classes.
SmartPointer< Self > Pointer
Definition: itkOptimizer.h:44
Generic representation for an optimization method.
Definition: itkOptimizer.h:38
SmartPointer< const Self > ConstPointer
Definition: itkOptimizer.h:45
ParametersType m_CurrentPosition
Definition: itkOptimizer.h:101
bool m_ScalesInitialized
Definition: itkOptimizer.h:96
Object Superclass
Definition: itkOptimizer.h:43
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual ~Optimizer()
Definition: itkOptimizer.h:90
Optimizer Self
Definition: itkOptimizer.h:42
Base class for most ITK classes.
Definition: itkObject.h:57
virtual void StartOptimization()
Definition: itkOptimizer.h:83
OptimizerParameters< double > ParametersType
Definition: itkOptimizer.h:51
Array< double > ScalesType
Definition: itkOptimizer.h:63