ITK  4.6.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 #include "itkDomainThreader.h"
25 
26 namespace itk
27 {
38 template<typename TInternalComputationValueType>
40  : public ObjectToObjectOptimizerBaseTemplate<TInternalComputationValueType>
41 {
42 public:
48 
51 
53  typedef enum {
62 
65 
68 
70  typedef TInternalComputationValueType InternalComputationValueType;
71 
74  typedef typename MetricType::Pointer MetricTypePointer;
75 
78 
81 
83 
85 
89 
91  itkGetConstReferenceMacro( Gradient, DerivativeType );
92 
94  itkGetConstReferenceMacro(StopCondition, StopConditionType);
95 
97  itkSetMacro(NumberOfIterations, SizeValueType);
98 
100  itkGetConstMacro(NumberOfIterations, SizeValueType);
101 
103  itkGetConstMacro(CurrentIteration, SizeValueType);
104 
106  virtual void StartOptimization( bool doOnlyInitialization = false ) ITK_OVERRIDE;
107 
111  virtual void ResumeOptimization() = 0;
112 
115  virtual void StopOptimization(void);
116 
118  virtual const StopConditionReturnStringType GetStopConditionDescription() const ITK_OVERRIDE;
119 
132  virtual void ModifyGradientByScales();
133  virtual void ModifyGradientByLearningRate();
135 
137 
143  virtual void ModifyGradientByScalesOverSubRange( const IndexRangeType& subrange ) = 0;
144 
153  virtual void ModifyGradientByLearningRateOverSubRange( const IndexRangeType& subrange ) = 0;
154 
155 protected:
156 
159  virtual ~GradientDescentOptimizerBasev4Template();
161 
166 
171 
178  TInternalComputationValueType m_MaximumStepSizeInPhysicalUnits;
179 
185 
191 
194 
196  typename DomainThreader<ThreadedIndexedContainerPartitioner, Self>::Pointer m_ModifyGradientByLearningRateThreader;
197 
198  /* Common variables for optimization control and reporting */
199  bool m_Stop;
202 
205  virtual void PrintSelf(std::ostream & os, Indent indent) const;
206 
207 private:
208 
209  GradientDescentOptimizerBasev4Template( const Self & ); //purposely not implemented
210  void operator=( const Self& ); //purposely not implemented
211 
212 };
213 
215 typedef GradientDescentOptimizerBasev4Template<double> GradientDescentOptimizerBasev4;
216 
217 } // end namespace itk
218 
219 #ifndef ITK_MANUAL_INSTANTIATION
220 #include "itkGradientDescentOptimizerBasev4.hxx"
221 #endif
222 
223 #endif
virtual void StartOptimization(bool doOnlyInitialization=false) ITK_OVERRIDE
OptimizerParameters< TInternalComputationValueType > ScalesType
Light weight base class for most itk classes.
Superclass::StopConditionDescriptionType StopConditionDescriptionType
Multi-threaded processing on a domain by processing sub-domains per thread.
virtual void ModifyGradientByLearningRateOverSubRange(const IndexRangeType &subrange)=0
Superclass::StopConditionReturnStringType StopConditionReturnStringType
DomainThreader< ThreadedIndexedContainerPartitioner, Self >::Pointer m_ModifyGradientByLearningRateThreader
virtual const StopConditionReturnStringType GetStopConditionDescription() const ITK_OVERRIDE
unsigned long SizeValueType
Definition: itkIntTypes.h:143
ObjectToObjectMetricBaseTemplate< TInternalComputationValueType > MetricType
Class to hold and manage different parameter types used during optimization.
Class which monitors convergence during the course of optimization.
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
itk::Function::WindowConvergenceMonitoringFunction< TInternalComputationValueType > ConvergenceMonitoringType