Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

mitkOptimizer.h

00001 /*=========================================================================
00002 
00003   Program:   3DMed
00004   Date:      $Date: 2014-02-25 18:30:00 +0800 $
00005   Version:   $Version: 4.6.0 $
00006   Copyright: MIPG, Institute of Automation, Chinese Academy of Sciences
00007 
00008 =========================================================================*/
00009 
00010 
00011 #ifndef __mitkOptimizer_h
00012 #define __mitkOptimizer_h
00013 
00014 #include "mitkRegistrationIncludes.h"
00015 #include "mitkProcessObject.h"
00016 #include "mitkMetric.h"
00017 
00023 
00024 class MITK_REGISTRATION_API mitkOptimizer : public mitkProcessObject
00025 {
00026 public:
00027     MITK_TYPE(mitkOptimizer, mitkProcessObject) 
00028     virtual void PrintSelf(ostream &os);
00029 
00034     virtual void SetInitialParameters(VectorParameterType & param ) {m_InitialParameters = param;}
00035 
00040     virtual VectorParameterType& GetInitialParameters();
00041 
00046     void SetScales(VectorParameterType& scales);
00047 
00053     void SetScales(ScalarParameterType* scales, unsigned int length);
00054 
00059     VectorParameterType & GetScales();
00060 
00065     virtual VectorParameterType & GetLastParameters();
00066 
00071     void SetMetric(mitkMetric *metric) {m_Metric = metric;}
00072 
00077     mitkMetric* GetMetric();
00078 
00083     void SetMaxIterations(unsigned int n) {m_MaxIterations = n;}
00084 
00089     unsigned int GetMaxIterationNumber() { return m_MaxIterations; }
00090 
00094     virtual void Update();
00095 
00100     void SetNumberOfParameters(unsigned int num){ m_NumberOfParameters = num; }
00101 
00106     unsigned int GetNumberOfParameters() { return m_NumberOfParameters; }
00107 
00112     void SetSpaceDimension(unsigned int dim) { m_SpaceDimension = dim; }
00113 
00118     unsigned int GetSpaceDimension() { return m_SpaceDimension; }
00119 
00124     void SetCurrentIterationNumber(unsigned int iterations) { m_Iterations = iterations; }
00125 
00130     unsigned int GetCurrentIterationNumber() { return m_Iterations; }
00131 
00136     VectorParameterType &   GetCurrentPosition() { return m_CurrentPosition; }
00137 
00142     void GetCurrentPosition(double* currentPosition);
00143 
00148     void SetMaximizeFlag(bool flag) { m_FlagMaximize = flag; }
00149 
00154     bool GetMaximizeFlag() { return m_FlagMaximize; }
00155 
00160     void SetStopFlag(bool flag) { m_FlagStop = flag; }
00161 
00166     bool GetStopFlag() { return m_FlagStop; }
00167 
00168     enum StopCondition{ Tolerance, StepTooSmall, Terminated, ParameterSizeErr, 
00169         GetValueErr, MaxIterations, StopByUser, RoutineFail};
00170 
00175     void StopOptimization( StopCondition condition );
00176 
00177 protected:
00178     mitkOptimizer();
00179     virtual ~mitkOptimizer();
00180     virtual bool Execute();
00181 
00182     mitkRCPtr<mitkMetric>                       m_Metric;
00183 
00184     VectorParameterType                         m_InitialParameters;
00185     VectorParameterType                         m_LastParameters;
00186     VectorParameterType                         m_Scales;
00187     VectorParameterType                         m_CurrentPosition;
00188 
00189     unsigned int                                m_MaxIterations;
00190     unsigned int                                m_Iterations;
00191     unsigned int                                m_NumberOfParameters;
00192     unsigned int                                m_SpaceDimension;
00193 
00194     bool                                        m_FlagMaximize;
00195     bool                                        m_FlagStop;
00196     
00197 private:
00198     mitkOptimizer(const mitkOptimizer&);
00199     void operator = (const mitkOptimizer&);
00200 };
00201 
00202 
00203 //#define DEFINED_mitkOptimizer
00204 
00205 
00206 
00207 #endif
00208 

Generated on Tue Feb 25 15:00:37 2014 for MITK (Medical Imaging ToolKit) by  doxygen 1.4.3