00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkOptimizer.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-06-24 12:02:54 $ 00007 Version: $Revision: 1.39 $ 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 __itkOptimizer_h 00018 #define __itkOptimizer_h 00019 00020 #include "itkObject.h" 00021 #include "itkObjectFactory.h" 00022 #include "itkExceptionObject.h" 00023 #include "itkArray.h" 00024 00025 00026 namespace itk 00027 { 00028 00037 class ITK_EXPORT Optimizer : public Object 00038 { 00039 public: 00041 typedef Optimizer Self; 00042 typedef Object Superclass; 00043 typedef SmartPointer<Self> Pointer; 00044 typedef SmartPointer<const Self> ConstPointer; 00045 00047 itkNewMacro(Self); 00048 00050 itkTypeMacro(Optimizer, Object); 00051 00054 typedef Array<double> ParametersType; 00055 00062 typedef Array<double> ScalesType; 00063 00065 virtual void SetInitialPosition( const ParametersType & param ); 00066 00068 itkGetConstReferenceMacro(InitialPosition, ParametersType); 00069 00071 void SetScales(const ScalesType & scales); 00072 00074 itkGetConstReferenceMacro( Scales, ScalesType ); 00075 00077 itkGetConstReferenceMacro( CurrentPosition, ParametersType ); 00078 00080 virtual void StartOptimization() {}; 00081 00083 virtual const std::string GetStopConditionDescription() const; 00084 00085 protected: 00086 Optimizer(); 00087 virtual ~Optimizer() {}; 00088 void PrintSelf(std::ostream& os, Indent indent) const; 00089 00091 virtual void SetCurrentPosition( const ParametersType & param ); 00092 00093 bool m_ScalesInitialized; 00094 00095 // Keep m_CurrentPosition as a protected var so that subclasses can 00096 // have fast access. This is important when optimizing high-dimensional 00097 // spaces, e.g. bspline transforms. 00098 ParametersType m_CurrentPosition; 00099 00100 private: 00101 Optimizer(const Self&); //purposely not implemented 00102 void operator=(const Self&); //purposely not implemented 00103 00104 ParametersType m_InitialPosition; 00105 ScalesType m_Scales; 00106 }; 00107 00108 } // end namespace itk 00109 00110 00111 #endif 00112