Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __itkRSGDEachParameterApartBaseOptimizer_h
00016 #define __itkRSGDEachParameterApartBaseOptimizer_h
00017
00018 #include "itkSingleValuedNonLinearOptimizer.h"
00019
00020 namespace itk
00021 {
00022
00032 class RSGDEachParameterApartBaseOptimizer :
00033 public SingleValuedNonLinearOptimizer
00034 {
00035 public:
00037 typedef RSGDEachParameterApartBaseOptimizer Self;
00038 typedef SingleValuedNonLinearOptimizer Superclass;
00039 typedef SmartPointer<Self> Pointer;
00040 typedef SmartPointer<const Self> ConstPointer;
00041
00043 itkNewMacro(Self);
00044
00046 itkTypeMacro( RSGDEachParameterApartBaseOptimizer,
00047 SingleValuedNonLinearOptimizer );
00048
00050 typedef enum {
00051 GradientMagnitudeTolerance=1,
00052 StepTooSmall,
00053 ImageNotAvailable,
00054 SamplesNotAvailable,
00055 MaximumNumberOfIterations,
00056 MetricError
00057 } StopConditionType;
00058
00060 itkSetMacro( Maximize, bool );
00061 itkGetConstMacro( Maximize, bool );
00062 itkBooleanMacro( Maximize );
00063 bool GetMinimize( ) const
00064 { return !m_Maximize; }
00065 void SetMinimize(bool v)
00066 { this->SetMaximize(!v); }
00067 void MinimizeOn(void)
00068 { SetMaximize( false ); }
00069 void MinimizeOff(void)
00070 { SetMaximize( true ); }
00071
00073 void StartOptimization( void );
00074
00077 void ResumeOptimization( void );
00078
00081 void StopOptimization( void );
00082
00084 itkSetMacro( MaximumStepLength, double );
00085 itkSetMacro( MinimumStepLength, double );
00086 itkSetMacro( NumberOfIterations, unsigned long );
00087 itkSetMacro( GradientMagnitudeTolerance, double );
00088 itkGetConstMacro( MaximumStepLength, double );
00089 itkGetConstMacro( MinimumStepLength, double );
00090 itkGetConstMacro( NumberOfIterations, unsigned long );
00091 itkGetConstMacro( GradientMagnitudeTolerance, double );
00092 itkGetConstMacro( CurrentIteration, unsigned long );
00093 itkGetConstMacro( StopCondition, StopConditionType );
00094 itkGetConstMacro( Value, MeasureType );
00095 itkGetConstReferenceMacro( Gradient, DerivativeType );
00096
00098 itkGetConstReferenceMacro( CurrentStepLengths, DerivativeType);
00099
00101 itkGetConstMacro( CurrentStepLength, double);
00102
00104 itkGetConstMacro( GradientMagnitude, double);
00105
00106 protected:
00107
00108 RSGDEachParameterApartBaseOptimizer();
00109 virtual ~RSGDEachParameterApartBaseOptimizer() {};
00110 void PrintSelf(std::ostream& os, Indent indent) const;
00111
00115 virtual void AdvanceOneStep( void );
00116
00127 virtual void StepAlongGradient(
00128 const DerivativeType &,
00129 const DerivativeType&)
00130 {
00131 ExceptionObject ex;
00132 ex.SetLocation(__FILE__);
00133 ex.SetDescription("This method MUST be overloaded in derived classes");
00134 throw ex;
00135 }
00136
00137 private:
00138
00139 RSGDEachParameterApartBaseOptimizer( const Self& );
00140 void operator=( const Self& );
00141
00142 protected:
00143
00144 DerivativeType m_Gradient;
00145 DerivativeType m_PreviousGradient;
00146
00147 bool m_Stop;
00148 bool m_Maximize;
00149 MeasureType m_Value;
00150 double m_GradientMagnitudeTolerance;
00151 double m_MaximumStepLength;
00152 double m_MinimumStepLength;
00153
00155 DerivativeType m_CurrentStepLengths;
00157 double m_CurrentStepLength;
00158
00159 StopConditionType m_StopCondition;
00160 unsigned long m_NumberOfIterations;
00161 unsigned long m_CurrentIteration;
00162
00163 double m_GradientMagnitude;
00164
00165 };
00166
00167 }
00168
00169
00170
00171 #endif // end #ifndef __itkRSGDEachParameterApartBaseOptimizer_h
00172
00173
00174