ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkGradientDescentOptimizerv4.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkGradientDescentOptimizerv4_h
00019 #define __itkGradientDescentOptimizerv4_h
00020 
00021 #include "itkGradientDescentOptimizerBasev4.h"
00022 #include "itkOptimizerParameterScalesEstimator.h"
00023 
00024 namespace itk
00025 {
00062 class ITK_EXPORT GradientDescentOptimizerv4
00063   : public GradientDescentOptimizerBasev4
00064 {
00065 public:
00067   typedef GradientDescentOptimizerv4     Self;
00068   typedef GradientDescentOptimizerBasev4 Superclass;
00069   typedef SmartPointer< Self >           Pointer;
00070   typedef SmartPointer< const Self >     ConstPointer;
00071 
00073   itkTypeMacro(GradientDescentOptimizerv4, GradientDescentOptimizerBasev4);
00074 
00076   itkNewMacro(Self);
00077 
00079   typedef Superclass::DerivativeType      DerivativeType;
00080 
00082   typedef Superclass::MeasureType                  MeasureType;
00083   typedef Superclass::InternalComputationValueType InternalComputationValueType;
00084 
00086   itkSetMacro(LearningRate, InternalComputationValueType);
00087 
00089   itkGetConstReferenceMacro(LearningRate, InternalComputationValueType);
00090 
00092   itkSetMacro(MaximumStepSizeInPhysicalUnits, InternalComputationValueType);
00093 
00095   itkSetObjectMacro(ScalesEstimator, OptimizerParameterScalesEstimator);
00096 
00098   virtual void StartOptimization();
00099 
00102   virtual void ResumeOptimization();
00103 
00104 protected:
00105 
00108   virtual void AdvanceOneStep(void);
00109 
00111   virtual void ModifyGradientByScalesOverSubRange( const IndexRangeType& subrange );
00112   virtual void ModifyGradientByLearningRateOverSubRange( const IndexRangeType& subrange );
00114 
00115   InternalComputationValueType  m_LearningRate;
00116 
00118   InternalComputationValueType  m_MaximumStepSizeInPhysicalUnits;
00119 
00121   virtual void EstimateLearningRate();
00122 
00124   GradientDescentOptimizerv4();
00125 
00127   virtual ~GradientDescentOptimizerv4();
00128 
00129   virtual void PrintSelf( std::ostream & os, Indent indent ) const;
00130 
00131   OptimizerParameterScalesEstimator::Pointer m_ScalesEstimator;
00132 
00133 private:
00134   GradientDescentOptimizerv4( const Self & ); //purposely not implemented
00135   void operator=( const Self& ); //purposely not implemented
00136 };
00137 
00138 } // end namespace itk
00139 
00140 #endif
00141