ITK  4.2.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 
24 
25 namespace itk
26 {
40 {
41 public:
47 
50 
52  typedef enum {
59  OTHER_ERROR
60  } StopConditionType;
61 
63  typedef std::string StopConditionReturnStringType;
64 
66  typedef std::ostringstream StopConditionDescriptionType;
67 
69  typedef Superclass::MetricType MetricType;
71 
74 
77 
80 
82  itkGetConstReferenceMacro( Gradient, DerivativeType );
83 
85  itkGetConstReferenceMacro(StopCondition, StopConditionType);
86 
88  itkSetMacro(NumberOfIterations, SizeValueType);
89 
91  itkGetConstReferenceMacro(NumberOfIterations, SizeValueType);
92 
94  itkGetConstMacro(CurrentIteration, SizeValueType);
95 
99  virtual void ResumeOptimization() = 0;
100 
103  virtual void StopOptimization(void);
104 
106  virtual const StopConditionReturnStringType GetStopConditionDescription() const;
107 
120  virtual void ModifyGradientByScales();
121  virtual void ModifyGradientByLearningRate();
123 
124 protected:
125 
130 
133 
135 
138 
144  virtual void ModifyGradientByScalesOverSubRange( const IndexRangeType& subrange ) = 0;
145 
151  virtual void ModifyGradientByLearningRateOverSubRange( const IndexRangeType& subrange ) = 0;
152 
153  /* Common variables for optimization control and reporting */
154  bool m_Stop;
159 
162  virtual void PrintSelf(std::ostream & os, Indent indent) const;
163 
164 private:
165  GradientDescentOptimizerBasev4( const Self & ); //purposely not implemented
166  void operator=( const Self& ); //purposely not implemented
167 
168 };
169 
170 } // end namespace itk
171 
172 #endif
173