freSetupOptimizationMetricThreadBase.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   F.R.E.E. - flexible registration evaluation engine
00004   Version:   v.1.0.0
00005   Date:      $Date: 2006/09/01 12:00:00 $
00006   Module:    $RCSfile: freSetupOptimizationMetricThreadBase.h,v $
00007   Language:  C++
00008 
00009 
00010 
00011   Copyright (c) 2007 Ralf o Floca (Department of Medical Informatics,
00012   Institute for Medical Biometry and Informatics, University of Heidelberg,
00013   Germany). All rights reserved.
00014   See FREECopyright.txt or http://www.mi.med.uni-hd.de/free/copyright.htm
00015   for details.
00016 
00017      This software is distributed WITHOUT ANY WARRANTY; without even 
00018      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00019      PURPOSE.  See the above copyright notices for more information.
00020 
00021 =========================================================================*/
00022 #ifndef __freSetupOptimizationMetricThreadBase_h
00023 #define __freSetupOptimizationMetricThreadBase_h
00024 
00025 #include "freExceptions.h"
00026 #include "freSetup.h"
00027 
00028 #include "itkObject.h"
00029 #include "itkMutexLock.h"
00030 
00031 namespace FREE
00032 {
00033 
00044 template <typename TMonitor>
00045 class ITK_EXPORT SetupOptimizationMetricThreadBase : 
00046   public itk::Object
00047 {
00048 public:
00050   typedef SetupOptimizationMetricThreadBase<TMonitor>   Self;
00051   typedef itk::Object                       Superclass;
00052         typedef itk::SmartPointer<Self>           Pointer;
00053   typedef itk::SmartPointer<const Self>     ConstPointer;
00054 
00055   typedef long ThreadIDType;
00056 
00057   typedef TMonitor                MonitorType;
00060   typedef typename MonitorType::ResultType ResultType;
00061 
00063   itkTypeMacro( SetupOptimizationMetricThreadBase, itk::Object );
00064 
00066   void SetMonitor(MonitorType* pMonitor);
00067 
00068   ThreadIDType GetThreadID() const;
00069   void SetThreadID(const ThreadIDType& id);
00070 
00080   virtual void Execute();
00081 
00082 protected:
00083 
00084   SetupOptimizationMetricThreadBase();
00085 
00086   virtual ~SetupOptimizationMetricThreadBase();
00087 
00097   virtual bool ProcessSetup(Setup* pAdaptationSetup) throw() = 0;
00098 
00099   void LockExecutionMutex();
00100   void UnlockExecutionMutex();
00101 
00102   typedef ProgressCtrlEvent< SetupOptimizationMetricThreadBase<TMonitor> > ProgressEventType;
00103   typename ProgressEventType::Pointer m_EvaluatedSessionProgressEvent;
00107   void OnSessionProgress(const IDPath& senderID,
00108                          const ProgressCtrlEventBase::StatusID status,
00109                          const std::string& sComment,
00110                          SessionComponentCache* pSender,
00111                          long threadID);
00112 
00113   std::string m_FailureComment;
00114   ResultType m_Results;
00115 
00116 private:
00117 
00118   ThreadIDType m_ThreadID;
00119 
00120   MonitorType* m_pMonitor;
00121 
00124   itk::SimpleMutexLock m_ExecutionMutex;
00125 
00126   SetupOptimizationMetricThreadBase(const Self&); //purposely not implemented
00127   void operator=(const Self&); //purposely not implemented
00128 };
00129 
00130 } // end namespace FREE
00131 
00132 #ifndef ITK_MANUAL_INSTANTIATION
00133 #include "freSetupOptimizationMetricThreadBase.txx"
00134 #endif
00135 
00136 #endif
00137 
00138 
00139 

Generated at Sat Oct 13 17:27:30 2007 for f.r.e.e. - Flexible Registration and Evaluation Engine by doxygen 1.5.3 written by Dimitri van Heesch, © 1997-2000