Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkPowellOptimizer.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkPowellOptimizer.h,v $
00005   Language:  C++
00006   Date:      $Date: 2005/04/27 15:08:57 $
00007   Version:   $Revision: 1.3 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkPowellOptimizer_h
00018 #define __itkPowellOptimizer_h
00019 
00020 #include <itkVector.h>
00021 #include <itkMatrix.h>
00022 #include <itkSingleValuedNonLinearOptimizer.h>
00023 
00024 namespace itk
00025 {
00026 
00054 class ITK_EXPORT PowellOptimizer: 
00055     public SingleValuedNonLinearOptimizer
00056 {
00057 public:
00059   typedef PowellOptimizer             Self ;
00060   typedef SingleValuedNonLinearOptimizer      Superclass;
00061   typedef SmartPointer<Self>                  Pointer;
00062   typedef SmartPointer<const Self>            ConstPointer;
00063 
00064   typedef SingleValuedNonLinearOptimizer::ParametersType
00065                                               ParametersType;
00066   
00068   itkNewMacro(Self);
00069  
00071   itkTypeMacro(PowellOptimizer, SingleValuedNonLinearOptimizer );
00072   
00074   typedef  SingleValuedCostFunction         CostFunctionType;
00075   typedef  CostFunctionType::Pointer        CostFunctionPointer;
00076 
00078   itkSetMacro( Maximize, bool );
00079   itkGetConstReferenceMacro( Maximize, bool );
00080 
00082   itkSetMacro( MaximumIteration, unsigned int );
00083   itkGetConstReferenceMacro( MaximumIteration, unsigned int );
00084 
00086   itkSetMacro(MaximumLineIteration, unsigned int);
00087   itkGetConstMacro(MaximumLineIteration, unsigned int);
00088 
00091   itkSetMacro( StepLength, double ) ;
00092   itkGetConstReferenceMacro( StepLength, double );
00093 
00096   itkSetMacro( StepTolerance, double ) ;
00097   itkGetConstReferenceMacro( StepTolerance, double );
00098 
00102   itkSetMacro( ValueTolerance, double ) ;
00103   itkGetConstReferenceMacro( ValueTolerance, double );
00104 
00106   itkGetConstReferenceMacro( CurrentCost, MeasureType );
00107   MeasureType GetValue() const { return this->GetCurrentCost(); }
00108 
00110   itkGetConstReferenceMacro( CurrentIteration, unsigned int);
00111 
00113   itkGetConstReferenceMacro( CurrentLineIteration, unsigned int);
00114 
00116   void StartOptimization() ;
00117 
00121   void StopOptimization() 
00122     { m_Stop = true ; }
00123 
00124 protected:
00125   PowellOptimizer() ;
00126   PowellOptimizer(const PowellOptimizer&) ;
00127   virtual ~PowellOptimizer() ;
00128   void PrintSelf(std::ostream& os, Indent indent) const;
00129 
00130   itkSetMacro(CurrentCost, double);
00131 
00134   void SetLine(const ParametersType & origin,
00135                const vnl_vector<double> & direction);
00136 
00140   double GetLineValue(double x) const;
00141 
00144   void   SetCurrentLinePoint(double x, double fx);
00145 
00148   void   Swap(double *a, double *b) const;
00149 
00152   void   Shift(double *a, double *b, double *c, double d) const;
00153 
00160   virtual void   LineBracket(double *ax, double *bx, double *cx,
00161                              double *fa, double *fb, double *fc);
00162 
00168   virtual void   BracketedLineOptimize(double ax, double bx, double cx,
00169                                        double fa, double fb, double fc,
00170                                        double * extX, double * extVal);
00171 
00172   itkGetMacro(SpaceDimension, unsigned int);
00173   itkSetMacro(SpaceDimension, unsigned int);
00174 
00175   itkSetMacro(CurrentIteration, unsigned int);
00176 
00177   itkGetMacro(Stop, bool);
00178   itkSetMacro(Stop, bool);
00179 
00180 
00181 private:
00182 
00183   unsigned int       m_SpaceDimension;
00184 
00186   unsigned int       m_CurrentIteration ;
00187   unsigned int       m_CurrentLineIteration ;
00188 
00190   unsigned int       m_MaximumIteration ;
00191   unsigned int       m_MaximumLineIteration ;
00192 
00194   bool               m_Maximize;
00195 
00197   double             m_StepLength ;
00198   double             m_StepTolerance ;
00199 
00200   ParametersType     m_LineOrigin;
00201   vnl_vector<double> m_LineDirection;
00202 
00203   double             m_ValueTolerance;
00204 
00206   MeasureType        m_CurrentCost;
00207 
00212   bool               m_Stop ;
00213 
00214 } ; // end of class
00215 
00216 } // end of namespace itk
00217 
00218 #endif

Generated at Tue Aug 30 16:45:55 2005 for ITK by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2000