ITK  4.13.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:
87 
89  itkNewMacro(Self);
90 
93 
96 
99 
101  typedef typename Superclass::ParametersType ParametersType;
102 
104  typedef typename Superclass::ScalesType ScalesType;
105 
106  virtual void StartOptimization(bool doOnlyInitialization = false) ITK_OVERRIDE;
107 
109  void StartWalking();
110 
112  void ResumeWalking();
113 
115  void StopWalking();
116 
117  itkSetMacro(StepLength, double);
118  itkSetMacro(NumberOfSteps, StepsType);
119  itkGetConstReferenceMacro(StepLength, double);
120  itkGetConstReferenceMacro(NumberOfSteps, StepsType);
121  itkGetConstReferenceMacro(CurrentValue, MeasureType);
122  itkGetConstReferenceMacro(MaximumMetricValue, MeasureType);
123  itkGetConstReferenceMacro(MinimumMetricValue, MeasureType);
124  itkGetConstReferenceMacro(MinimumMetricValuePosition, ParametersType);
125  itkGetConstReferenceMacro(MaximumMetricValuePosition, ParametersType);
126  itkGetConstReferenceMacro(CurrentIndex, ParametersType);
127 
129  virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE;
130 
132  void SetInitialPosition(const ParametersType & param);
133 
135  ParametersType & GetInitialPosition(void)
136  {
137  return m_InitialPosition;
138  }
139 
140 protected:
142  virtual ~ExhaustiveOptimizerv4() ITK_OVERRIDE {}
143  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
144 
146  void AdvanceOneStep();
147 
148  void IncrementIndex(ParametersType & param);
149 
150 protected:
154  bool m_Stop;
155  double m_StepLength;
161 
162 private:
163  ITK_DISALLOW_COPY_AND_ASSIGN(ExhaustiveOptimizerv4);
164 
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
Superclass::ParametersType ParametersType
Superclass::MeasureType MeasureType
SmartPointer< const Self > ConstPointer
ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType > Superclass
Array< SizeValueType > StepsType
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.