go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elxQuasiNewtonLBFGS.h
Go to the documentation of this file.
00001 /*======================================================================
00002 
00003   This file is part of the elastix software.
00004 
00005   Copyright (c) University Medical Center Utrecht. All rights reserved.
00006   See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
00007   details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE. See the above copyright notices for more information.
00012 
00013 ======================================================================*/
00014 
00015 #ifndef __elxQuasiNewtonLBFGS_h
00016 #define __elxQuasiNewtonLBFGS_h
00017 
00018 #include "itkQuasiNewtonLBFGSOptimizer.h"
00019 #include "itkMoreThuenteLineSearchOptimizer.h"
00020 #include "elxIncludes.h"
00021 
00022 namespace elastix
00023 {
00024 using namespace itk;
00025 
00026 
00086   template <class TElastix>
00087     class QuasiNewtonLBFGS :
00088     public
00089       itk::QuasiNewtonLBFGSOptimizer,
00090     public
00091       OptimizerBase<TElastix>
00092   {
00093   public:
00094 
00096     typedef QuasiNewtonLBFGS                    Self;
00097     typedef QuasiNewtonLBFGSOptimizer           Superclass1;
00098     typedef OptimizerBase<TElastix>             Superclass2;
00099     typedef SmartPointer<Self>                  Pointer;
00100     typedef SmartPointer<const Self>            ConstPointer;
00101 
00103     itkNewMacro( Self );
00104 
00106     itkTypeMacro( QuasiNewtonLBFGS, QuasiNewtonLBFGSOptimizer );
00107 
00112     elxClassNameMacro( "QuasiNewtonLBFGS" );
00113 
00115     typedef Superclass1::CostFunctionType                   CostFunctionType;
00116     typedef Superclass1::CostFunctionPointer                CostFunctionPointer;
00117     typedef Superclass1::StopConditionType                  StopConditionType;
00118     typedef Superclass1::ParametersType                     ParametersType;
00119     typedef Superclass1::DerivativeType                     DerivativeType;
00120     typedef Superclass1::ScalesType                         ScalesType;
00121 
00123     typedef typename Superclass2::ElastixType           ElastixType;
00124     typedef typename Superclass2::ElastixPointer        ElastixPointer;
00125     typedef typename Superclass2::ConfigurationType     ConfigurationType;
00126     typedef typename Superclass2::ConfigurationPointer  ConfigurationPointer;
00127     typedef typename Superclass2::RegistrationType      RegistrationType;
00128     typedef typename Superclass2::RegistrationPointer   RegistrationPointer;
00129     typedef typename Superclass2::ITKBaseType           ITKBaseType;
00130 
00132     typedef MoreThuenteLineSearchOptimizer              LineOptimizerType;
00133     typedef LineOptimizerType::Pointer                  LineOptimizerPointer;
00134     typedef ReceptorMemberCommand<Self>                 EventPassThroughType;
00135     typedef typename EventPassThroughType::Pointer      EventPassThroughPointer;
00136 
00139     virtual void StartOptimization(void);
00140 
00143     virtual void BeforeRegistration(void);
00144     virtual void BeforeEachResolution(void);
00145     virtual void AfterEachResolution(void);
00146     virtual void AfterEachIteration(void);
00147     virtual void AfterRegistration(void);
00148 
00149     itkGetConstMacro(StartLineSearch, bool);
00150 
00151 
00152   protected:
00153 
00154     QuasiNewtonLBFGS();
00155     virtual ~QuasiNewtonLBFGS() {};
00156 
00157     LineOptimizerPointer          m_LineOptimizer;
00158 
00160     virtual std::string GetLineSearchStopCondition(void) const;
00161 
00164     virtual std::string DeterminePhase(void) const;
00165 
00169     virtual bool TestConvergence( bool firstLineSearchDone );
00170 
00175     virtual void LineSearch(
00176       const ParametersType searchDir,
00177       double & step,
00178       ParametersType & x,
00179       MeasureType & f,
00180       DerivativeType & g );
00181 
00182   private:
00183 
00184     QuasiNewtonLBFGS( const Self& );  // purposely not implemented
00185     void operator=( const Self& );              // purposely not implemented
00186 
00187     void InvokeIterationEvent(const EventObject & event);
00188 
00189     EventPassThroughPointer     m_EventPasser;
00190     double                      m_SearchDirectionMagnitude;
00191     bool                        m_StartLineSearch;
00192     bool                        m_GenerateLineSearchIterations;
00193     bool                        m_StopIfWolfeNotSatisfied;
00194     bool                        m_WolfeIsStopCondition;
00195 
00196   }; // end class QuasiNewtonLBFGS
00197 
00198 
00199 } // end namespace elastix
00200 
00201 #ifndef ITK_MANUAL_INSTANTIATION
00202 #include "elxQuasiNewtonLBFGS.hxx"
00203 #endif
00204 
00205 #endif // end #ifndef __elxQuasiNewtonLBFGS_h
00206 


Generated on 24-05-2012 for elastix by doxygen 1.7.6.1 elastix logo