ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkMultiStartOptimizerv4.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 itkMultiStartOptimizerv4_h
19 #define itkMultiStartOptimizerv4_h
20 
23 
24 namespace itk
25 {
39 template<typename TInternalComputationValueType>
40 class ITK_TEMPLATE_EXPORT MultiStartOptimizerv4Template
41 : public ObjectToObjectOptimizerBaseTemplate<TInternalComputationValueType>
42 {
43 public:
49 
52 
54  itkNewMacro(Self);
55 
57  typedef std::vector< ParametersType > ParametersListType;
58  typedef typename ParametersListType::size_type ParameterListSizeType;
59 
64 
66  typedef enum {
72  OTHER_ERROR
73  } StopConditionType;
74 
76  typedef typename Superclass::StopConditionReturnStringType StopConditionReturnStringType;
77 
79  typedef typename Superclass::StopConditionDescriptionType StopConditionDescriptionType;
80 
84  typedef TInternalComputationValueType InternalComputationValueType;
85 
87  typedef typename Superclass::MetricType MetricType;
88  typedef typename MetricType::Pointer MetricTypePointer;
89 
91  typedef typename MetricType::DerivativeType DerivativeType;
92 
95  typedef std::vector< MeasureType > MetricValuesListType;
96 
98  itkGetConstReferenceMacro(StopCondition, StopConditionType);
99 
101  void InstantiateLocalOptimizer();
102 
104  virtual void StartOptimization( bool doOnlyInitialization = false ) ITK_OVERRIDE;
105 
108  virtual void StopOptimization();
109 
112  virtual void ResumeOptimization();
113 
115  virtual const StopConditionReturnStringType GetStopConditionDescription() const ITK_OVERRIDE;
116 
118  ParametersListType & GetParametersList();
119 
121  void SetParametersList(ParametersListType & p);
122 
124  const MetricValuesListType & GetMetricValuesList() const;
125 
127  ParametersType GetBestParameters( );
128 
130  itkSetObjectMacro( LocalOptimizer, OptimizerType );
131  itkGetModifiableObjectMacro(LocalOptimizer, OptimizerType );
133 
134  inline ParameterListSizeType GetBestParametersIndex( ) { return this->m_BestParametersIndex; }
135 
136 protected:
139  virtual ~MultiStartOptimizerv4Template() ITK_OVERRIDE;
141 
142  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
143 
144  /* Common variables for optimization control and reporting */
145  bool m_Stop;
146  StopConditionType m_StopCondition;
147  StopConditionDescriptionType m_StopConditionDescription;
148  ParametersListType m_ParametersList;
149  MetricValuesListType m_MetricValuesList;
150  MeasureType m_MinimumMetricValue;
151  MeasureType m_MaximumMetricValue;
152  ParameterListSizeType m_BestParametersIndex;
153  OptimizerPointer m_LocalOptimizer;
154 
155 private:
156  ITK_DISALLOW_COPY_AND_ASSIGN(MultiStartOptimizerv4Template);
157 
158 };
159 
161 typedef MultiStartOptimizerv4Template<double> MultiStartOptimizerv4;
162 
163 } // end namespace itk
164 
165 #ifndef ITK_MANUAL_INSTANTIATION
166 #include "itkMultiStartOptimizerv4.hxx"
167 #endif
168 
169 #endif
Light weight base class for most itk classes.
MetricType::DerivativeType DerivativeType
std::vector< ParametersType > ParametersListType
Multi-start searches over input parameters and returns the best metric value.
itk::GradientDescentOptimizerv4Template< TInternalComputationValueType > LocalOptimizerType
LocalOptimizerType::Pointer LocalOptimizerPointer
Superclass::StopConditionReturnStringType StopConditionReturnStringType
ParametersListType::size_type ParameterListSizeType
Class to hold and manage different parameter types used during optimization.
Superclass::StopConditionDescriptionType StopConditionDescriptionType
TInternalComputationValueType InternalComputationValueType
std::vector< MeasureType > MetricValuesListType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Superclass::ParametersType ParametersType
ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType > OptimizerType
ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType > Superclass
MultiStartOptimizerv4Template Self
Abstract base for object-to-object optimizers.