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: 2007/03/11 00:50:10 $
00007   Version:   $Revision: 1.7 $
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 
00058 class ITK_EXPORT PowellOptimizer: 
00059     public SingleValuedNonLinearOptimizer
00060 {
00061 public:
00063   typedef PowellOptimizer             Self ;
00064   typedef SingleValuedNonLinearOptimizer      Superclass;
00065   typedef SmartPointer<Self>                  Pointer;
00066   typedef SmartPointer<const Self>            ConstPointer;
00067 
00068   typedef SingleValuedNonLinearOptimizer::ParametersType
00069                                               ParametersType;
00070   
00072   itkNewMacro(Self);
00073 
00075   itkTypeMacro(PowellOptimizer, SingleValuedNonLinearOptimizer );
00076 
00078   typedef  SingleValuedCostFunction         CostFunctionType;
00079   typedef  CostFunctionType::Pointer        CostFunctionPointer;
00080 
00082   itkSetMacro( Maximize, bool );
00083   itkGetConstReferenceMacro( Maximize, bool );
00085 
00087   itkSetMacro( MaximumIteration, unsigned int );
00088   itkGetConstReferenceMacro( MaximumIteration, unsigned int );
00090 
00092   itkSetMacro(MaximumLineIteration, unsigned int);
00093   itkGetConstMacro(MaximumLineIteration, unsigned int);
00095 
00098   itkSetMacro( StepLength, double ) ;
00099   itkGetConstReferenceMacro( StepLength, double );
00101 
00104   itkSetMacro( StepTolerance, double ) ;
00105   itkGetConstReferenceMacro( StepTolerance, double );
00107 
00111   itkSetMacro( ValueTolerance, double ) ;
00112   itkGetConstReferenceMacro( ValueTolerance, double );
00114 
00116   itkGetConstReferenceMacro( CurrentCost, MeasureType );
00117   MeasureType GetValue() const { return this->GetCurrentCost(); }
00119 
00121   itkGetConstReferenceMacro( CurrentIteration, unsigned int);
00122 
00124   itkGetConstReferenceMacro( CurrentLineIteration, unsigned int);
00125 
00127   void StartOptimization() ;
00128 
00132   void StopOptimization() 
00133     { m_Stop = true ; }
00134 
00135 protected:
00136   PowellOptimizer() ;
00137   PowellOptimizer(const PowellOptimizer&) ;
00138   virtual ~PowellOptimizer() ;
00139   void PrintSelf(std::ostream& os, Indent indent) const;
00140 
00141   itkSetMacro(CurrentCost, double);
00142 
00145   void SetLine(const ParametersType & origin,
00146                const vnl_vector<double> & direction);
00147 
00151   double GetLineValue(double x) const;
00152 
00155   void   SetCurrentLinePoint(double x, double fx);
00156 
00159   void   Swap(double *a, double *b) const;
00160 
00163   void   Shift(double *a, double *b, double *c, double d) const;
00164 
00175   virtual void   LineBracket(double *ax, double *bx, double *cx,
00176                              double *fa, double *fb, double *fc);
00177 
00183   virtual void   BracketedLineOptimize(double ax, double bx, double cx,
00184                                        double fa, double fb, double fc,
00185                                        double * extX, double * extVal);
00186 
00187   itkGetMacro(SpaceDimension, unsigned int);
00188   itkSetMacro(SpaceDimension, unsigned int);
00189 
00190   itkSetMacro(CurrentIteration, unsigned int);
00191 
00192   itkGetMacro(Stop, bool);
00193   itkSetMacro(Stop, bool);
00194 
00195  private:
00196 
00197   unsigned int       m_SpaceDimension;
00198 
00200   unsigned int       m_CurrentIteration ;
00201   unsigned int       m_CurrentLineIteration ;
00202 
00204   unsigned int       m_MaximumIteration ;
00205   unsigned int       m_MaximumLineIteration ;
00206 
00208   bool               m_Maximize;
00209 
00211   double             m_StepLength ;
00212   double             m_StepTolerance ;
00213 
00214   ParametersType     m_LineOrigin;
00215   vnl_vector<double> m_LineDirection;
00216 
00217   double             m_ValueTolerance;
00218 
00220   MeasureType        m_CurrentCost;
00221 
00226   bool               m_Stop ;
00227 
00228 } ; // end of class
00229 
00230 } // end of namespace itk
00231 
00232 #endif
00233 

Generated at Mon Mar 12 02:19:36 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000