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/01/10 18:55:58 $
00007   Version:   $Revision: 1.1 $
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 
00087   itkSetMacro( StepLength, double ) ;
00088   itkGetConstReferenceMacro( StepLength, double );
00089 
00092   itkSetMacro( StepTolerance, double ) ;
00093   itkGetConstReferenceMacro( StepTolerance, double );
00094 
00098   itkSetMacro( ValueTolerance, double ) ;
00099   itkGetConstReferenceMacro( ValueTolerance, double );
00100 
00102   itkGetConstReferenceMacro( CurrentCost, MeasureType );
00103   MeasureType GetValue() const { return this->GetCurrentCost(); }
00104 
00106   itkGetConstReferenceMacro( CurrentIteration, unsigned int) ;
00107 
00109   void StartOptimization() ;
00110 
00114   void StopOptimization() 
00115     { m_Stop = true ; }
00116 
00117 protected:
00118   PowellOptimizer() ;
00119   PowellOptimizer(const PowellOptimizer&) ;
00120   virtual ~PowellOptimizer() ;
00121   void PrintSelf(std::ostream& os, Indent indent) const;
00122 
00123   itkSetMacro(CurrentCost, double);
00124 
00127   void SetLine(const ParametersType & origin,
00128                const vnl_vector<double> & direction);
00129 
00133   double GetLineValue(double x) const;
00134 
00137   void   SetCurrentLinePoint(double x, double fx);
00138 
00141   void   Swap(double *a, double *b) const;
00142 
00145   void   Shift(double *a, double *b, double *c, double d) const;
00146 
00153   virtual void   LineBracket(double *ax, double *bx, double *cx,
00154                              double *fa, double *fb, double *fc);
00155 
00161   virtual void   BracketedLineOptimize(double ax, double bx, double cx,
00162                                        double fa, double fb, double fc,
00163                                        double * extX, double * extVal);
00164 
00165 private:
00166 
00167   unsigned int       m_SpaceDimension;
00168 
00170   unsigned int       m_CurrentIteration ;
00171   unsigned int       m_CurrentLineIteration ;
00172 
00174   unsigned int       m_MaximumIteration ;
00175   unsigned int       m_MaximumLineIteration ;
00176 
00178   bool               m_Maximize;
00179 
00181   double             m_StepLength ;
00182   double             m_StepTolerance ;
00183 
00184   ParametersType     m_LineOrigin;
00185   vnl_vector<double> m_LineDirection;
00186 
00187   double             m_ValueTolerance;
00188 
00190   MeasureType        m_CurrentCost;
00191 
00196   bool               m_Stop ;
00197 
00198 } ; // end of class
00199 
00200 } // end of namespace itk
00201 
00202 #endif

Generated at Wed Mar 30 00:08:05 2005 for ITK by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2000