ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkExhaustiveOptimizer.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 itkExhaustiveOptimizer_h
19 #define itkExhaustiveOptimizer_h
20 
21 #include "itkIntTypes.h"
23 #include "ITKOptimizersExport.h"
24 
25 namespace itk
26 {
79 class ITKOptimizers_EXPORT ExhaustiveOptimizer:
81 {
82 public:
83  ITK_DISALLOW_COPY_AND_ASSIGN(ExhaustiveOptimizer);
84 
90 
93  itkNewMacro(Self);
94 
97 
98  void StartOptimization() override;
99 
100  void StartWalking();
101 
102  void ResumeWalking();
103 
104  void StopWalking();
105 
106  itkSetMacro(StepLength, double);
107  itkSetMacro(NumberOfSteps, StepsType);
108  itkGetConstReferenceMacro(StepLength, double);
109  itkGetConstReferenceMacro(NumberOfSteps, StepsType);
110  itkGetConstReferenceMacro(CurrentValue, MeasureType);
111  itkGetConstReferenceMacro(MaximumMetricValue, MeasureType);
112  itkGetConstReferenceMacro(MinimumMetricValue, MeasureType);
113  itkGetConstReferenceMacro(MinimumMetricValuePosition, ParametersType);
114  itkGetConstReferenceMacro(MaximumMetricValuePosition, ParametersType);
115  itkGetConstReferenceMacro(CurrentIndex, ParametersType);
116  itkGetConstReferenceMacro(MaximumNumberOfIterations, SizeValueType);
117 
119  const std::string GetStopConditionDescription() const override;
120 
121 protected:
123  ~ExhaustiveOptimizer() override = default;
124  void PrintSelf(std::ostream & os, Indent indent) const override;
125 
127  void AdvanceOneStep();
128 
129  void IncrementIndex(ParametersType & param);
130 
131 protected:
132  MeasureType m_CurrentValue;
133 
135 
137 
138  bool m_Stop;
139 
140  unsigned int m_CurrentParameter;
141 
142  double m_StepLength;
143 
144  ParametersType m_CurrentIndex;
145 
147 
148  MeasureType m_MaximumMetricValue;
149 
150  MeasureType m_MinimumMetricValue;
151 
153 
155 
156 private:
157  std::ostringstream m_StopConditionDescription;
158 };
159 } // end namespace itk
160 
161 #endif
Light weight base class for most itk classes.
unsigned long SizeValueType
Definition: itkIntTypes.h:83
This class is a base for the Optimization methods that optimize a single valued function.
Optimizer that fully samples a grid on the parametric space.
std::ostringstream m_StopConditionDescription
Control indentation during Print() invocation.
Definition: itkIndent.h:49
ParametersType m_MaximumMetricValuePosition
ParametersType m_MinimumMetricValuePosition