ITK  5.0.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:
41  ITK_DISALLOW_COPY_AND_ASSIGN(Optimizer);
42 
44  using Self = Optimizer;
45  using Superclass = Object;
48 
50  itkNewMacro(Self);
51 
53  itkTypeMacro(Optimizer, Object);
54 
58 
66 
68  virtual void SetInitialPosition(const ParametersType & param);
69 
71  itkGetConstReferenceMacro(InitialPosition, ParametersType);
72 
74  void SetScales(const ScalesType & scales);
75 
77  itkGetConstReferenceMacro(Scales, ScalesType);
78  itkGetConstReferenceMacro(InverseScales, ScalesType);
80 
82  itkGetConstReferenceMacro(CurrentPosition, ParametersType);
83 
85  virtual void StartOptimization() {}
86 
88  virtual const std::string GetStopConditionDescription() const;
89 
90 protected:
91  Optimizer();
92  ~Optimizer() override = default;
93  void PrintSelf(std::ostream & os, Indent indent) const override;
94 
96  virtual void SetCurrentPosition(const ParametersType & param);
97 
98  bool m_ScalesInitialized{ false };
99 
100  // Keep m_CurrentPosition as a protected var so that subclasses can
101  // have fast access. This is important when optimizing high-dimensional
102  // spaces, e.g. bspline transforms.
104 
105 private:
109 };
110 } // end namespace itk
111 
112 #endif
Light weight base class for most itk classes.
ScalesType m_InverseScales
Definition: itkOptimizer.h:108
ScalesType m_Scales
Definition: itkOptimizer.h:107
Generic representation for an optimization method.
Definition: itkOptimizer.h:38
ParametersType m_InitialPosition
Definition: itkOptimizer.h:106
ParametersType m_CurrentPosition
Definition: itkOptimizer.h:103
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for most ITK classes.
Definition: itkObject.h:60
virtual void StartOptimization()
Definition: itkOptimizer.h:85