ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkExhaustiveOptimizerv4.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 itkExhaustiveOptimizerv4_h
19 #define itkExhaustiveOptimizerv4_h
20 
21 #include "itkIntTypes.h"
23 
24 namespace itk
25 {
77 template<typename TInternalComputationValueType>
78 class ITK_TEMPLATE_EXPORT ExhaustiveOptimizerv4:
79  public ObjectToObjectOptimizerBaseTemplate<TInternalComputationValueType>
80 {
81 public:
82  ITK_DISALLOW_COPY_AND_ASSIGN(ExhaustiveOptimizerv4);
83 
89 
91  itkNewMacro(Self);
92 
94  itkTypeMacro(ExhaustiveOptimizerv4, Superclass);
95 
98 
101 
103  using ParametersType = typename Superclass::ParametersType;
104 
106  using ScalesType = typename Superclass::ScalesType;
107 
108  void StartOptimization(bool doOnlyInitialization = false) override;
109 
111  void StartWalking();
112 
114  void ResumeWalking();
115 
117  void StopWalking();
118 
119  itkSetMacro(StepLength, double);
120  itkSetMacro(NumberOfSteps, StepsType);
121  itkGetConstReferenceMacro(StepLength, double);
122  itkGetConstReferenceMacro(NumberOfSteps, StepsType);
123  itkGetConstReferenceMacro(CurrentValue, MeasureType);
124  itkGetConstReferenceMacro(MaximumMetricValue, MeasureType);
125  itkGetConstReferenceMacro(MinimumMetricValue, MeasureType);
126  itkGetConstReferenceMacro(MinimumMetricValuePosition, ParametersType);
127  itkGetConstReferenceMacro(MaximumMetricValuePosition, ParametersType);
128  itkGetConstReferenceMacro(CurrentIndex, ParametersType);
129 
131  const std::string GetStopConditionDescription() const override;
132 
134  void SetInitialPosition(const ParametersType & param);
135 
138  {
139  return m_InitialPosition;
140  }
141 
142 protected:
144  ~ExhaustiveOptimizerv4() override = default;
145  void PrintSelf(std::ostream & os, Indent indent) const override;
146 
148  void AdvanceOneStep();
149 
150  void IncrementIndex(ParametersType & param);
151 
152 protected:
156  bool m_Stop{false};
157  double m_StepLength{1.0};
163 
164 private:
165  std::ostringstream m_StopConditionDescription;
166 };
167 } // end namespace itk
168 
169 #ifndef ITK_MANUAL_INSTANTIATION
170 #include "itkExhaustiveOptimizerv4.hxx"
171 #endif
172 
173 #endif
Light weight base class for most itk classes.
std::ostringstream m_StopConditionDescription
typename Superclass::MeasureType MeasureType
typename Superclass::ParametersType ParametersType
typename Superclass::ScalesType ScalesType
Optimizer that fully samples a grid on the parametric space.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Abstract base for object-to-object optimizers.