ITK  6.0.0
Insight Toolkit
itkOptimizer.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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_MOVE(Optimizer);
42 
44  using Self = Optimizer;
45  using Superclass = Object;
48 
50  itkNewMacro(Self);
51 
53  itkOverrideGetNameOfClassMacro(Optimizer);
54 
58 
66 
68  virtual void
69  SetInitialPosition(const ParametersType & param);
70 
72  itkGetConstReferenceMacro(InitialPosition, ParametersType);
73 
75  void
76  SetScales(const ScalesType & scales);
77 
79  itkGetConstReferenceMacro(Scales, ScalesType);
80  itkGetConstReferenceMacro(InverseScales, ScalesType);
84  itkGetConstReferenceMacro(CurrentPosition, ParametersType);
85 
87  virtual void
89  {}
90 
92  virtual std::string
93  GetStopConditionDescription() const;
94 
95 protected:
96  Optimizer();
97  ~Optimizer() override = default;
98  void
99  PrintSelf(std::ostream & os, Indent indent) const override;
100 
102  virtual void
103  SetCurrentPosition(const ParametersType & param);
104 
105  bool m_ScalesInitialized{ false };
106 
107  // Keep m_CurrentPosition as a protected var so that subclasses can
108  // have fast access. This is important when optimizing high-dimensional
109  // spaces, e.g. bspline transforms.
110  ParametersType m_CurrentPosition{};
111 
112 private:
113  ParametersType m_InitialPosition{};
114  ScalesType m_Scales{};
115  ScalesType m_InverseScales{};
116 };
117 } // end namespace itk
118 
119 #endif
itk::OptimizerParameters< double >
itkObjectFactory.h
itk::Optimizer
Generic representation for an optimization method.
Definition: itkOptimizer.h:38
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itkOptimizerParameters.h
itk::Optimizer::StartOptimization
virtual void StartOptimization()
Definition: itkOptimizer.h:88
itkArray.h
itkObject.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::Array< double >
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61