ITK  4.5.0
Insight Segmentation and Registration Toolkit
itkGradientDescentOptimizerBasev4.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 __itkGradientDescentOptimizerBasev4_h
19 #define __itkGradientDescentOptimizerBasev4_h
20 
22 
25 #include "itkDomainThreader.h"
26 
27 namespace itk
28 {
39 template<typename TInternalComputationValueType>
41  : public ObjectToObjectOptimizerBaseTemplate<TInternalComputationValueType>
42 {
43 public:
49 
52 
54  typedef enum {
62 
64  typedef std::string StopConditionReturnStringType;
65 
67  typedef std::ostringstream StopConditionDescriptionType;
68 
70  typedef TInternalComputationValueType InternalComputationValueType;
71 
74  typedef typename MetricType::Pointer MetricTypePointer;
75 
78 
81 
83 
85 
87  itkGetConstReferenceMacro( Gradient, DerivativeType );
88 
90  itkGetConstReferenceMacro(StopCondition, StopConditionType);
91 
93  itkSetMacro(NumberOfIterations, SizeValueType);
94 
96  itkGetConstReferenceMacro(NumberOfIterations, SizeValueType);
97 
99  itkGetConstMacro(CurrentIteration, SizeValueType);
100 
104  virtual void ResumeOptimization() = 0;
105 
108  virtual void StopOptimization(void);
109 
112 
125  virtual void ModifyGradientByScales();
126  virtual void ModifyGradientByLearningRate();
128 
130 
136  virtual void ModifyGradientByScalesOverSubRange( const IndexRangeType& subrange ) = 0;
137 
146  virtual void ModifyGradientByLearningRateOverSubRange( const IndexRangeType& subrange ) = 0;
147 
148 protected:
149 
154 
157 
158  /* Common variables for optimization control and reporting */
159  bool m_Stop;
164 
167  virtual void PrintSelf(std::ostream & os, Indent indent) const;
168 
169 private:
170  GradientDescentOptimizerBasev4Template( const Self & ); //purposely not implemented
171  void operator=( const Self& ); //purposely not implemented
172 
173 };
174 
177 
178 } // end namespace itk
179 
180 #ifndef ITK_MANUAL_INSTANTIATION
181 #include "itkGradientDescentOptimizerBasev4.hxx"
182 #endif
183 
184 #endif
Array class with size defined at construction time.
Definition: itkArray.h:50
OptimizerParameters< TInternalComputationValueType > ScalesType
Light weight base class for most itk classes.
virtual void ModifyGradientByLearningRateOverSubRange(const IndexRangeType &subrange)=0
OptimizerParameters< TInternalComputationValueType > ParametersType
virtual const StopConditionReturnStringType GetStopConditionDescription() const
DomainThreader< ThreadedIndexedContainerPartitioner, Self >::Pointer m_ModifyGradientByLearningRateThreader
unsigned long SizeValueType
Definition: itkIntTypes.h:143
ObjectToObjectMetricBaseTemplate< TInternalComputationValueType > MetricType
virtual void PrintSelf(std::ostream &os, Indent indent) const
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void ModifyGradientByScalesOverSubRange(const IndexRangeType &subrange)=0
DomainThreader< ThreadedIndexedContainerPartitioner, Self >::Pointer m_ModifyGradientByScalesThreader
Abstract base for object-to-object optimizers.
ObjectToObjectOptimizerBaseTemplate< TInternalComputationValueType > Superclass
ThreadedIndexedContainerPartitioner::IndexRangeType IndexRangeType
GradientDescentOptimizerBasev4Template< double > GradientDescentOptimizerBasev4