freSetupOptimizationMultiThreadMetric.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: freSetupOptimizationMultiThreadMetric.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 __freSetupOptimizationMultiThreadMetric_h
00023 #define __freSetupOptimizationMultiThreadMetric_h
00024 
00025 #include "freSetupOptimizationMetric.h"
00026 #include "freIDPath.h"
00027 
00028 #include "freImageTypes.h"
00029 
00030 namespace FREE
00031 {
00032 
00044 template <typename TMonitor, typename TThread>
00045 class ITK_EXPORT SetupOptimizationMultiThreadMetric : 
00046   public SetupOptimizationMetric
00047 {
00048 public:
00050   typedef SetupOptimizationMultiThreadMetric<TMonitor, TThread>   Self;
00051   typedef SetupOptimizationMetric           Superclass;
00052         typedef itk::SmartPointer<Self>           Pointer;
00053   typedef itk::SmartPointer<const Self>     ConstPointer;
00054 
00055   typedef TMonitor MonitorType;
00056   typedef typename MonitorType::Pointer MonitorPointer;
00057   typedef TThread  ThreadType;
00058   typedef typename ThreadType::Pointer ThreadPointer;
00059   typedef typename MonitorType::ResultType EvaluationResultType;
00060 
00062   itkTypeMacro( SetupOptimizationMultiThreadMetric, SetupOptimizationMetric );
00063 
00064   itkSetMacro( NumberOfThreads, long);
00065   itkGetMacro( NumberOfThreads, long);
00066 
00067 protected:
00068   SetupOptimizationMultiThreadMetric();
00069 
00070   virtual ~SetupOptimizationMultiThreadMetric();
00071 
00080         virtual DecomposedMeasureType ComputeDecomposedValue( const ParametersType & parameters ) const;
00081 
00082         virtual void InitializeValueComputation() const = 0;
00083         virtual void InitializeMonitor(MonitorType& monitor) const = 0;
00084   virtual void InitializeThread(ThreadType& thread) const = 0;
00085   virtual DecomposedMeasureType ComputeMeasure(MonitorType& monitor) const = 0;
00086 
00087   long m_NumberOfThreads;
00088 
00089   typedef std::vector<ThreadPointer> ThreadListType;
00090 
00091   /* these events are used to pass the events from the monitor to the outside world*/
00092   typename ProgressEvent<Self>::Pointer fnOnMonitorEvaluationProgress;
00093   /* these events are used to pass the events from the monitor to the outside world*/
00094   typename ProgressEvent<Self>::Pointer fnOnMonitorEvaluationDone;
00095   /* these events are used to pass the events from the monitor to the outside world*/
00096   typename ProgressEvent<Self>::Pointer fnOnMonitorNextAdaptation;
00097   /* these events are used to pass the events from the monitor to the outside world*/
00098   typename ProgressEvent<Self>::Pointer fnOnMonitorEvaluationFailed;
00099 
00100   void OnMonitorEvaluationProgress(const long status, const std::string& sComment, void* pSender, long threadID);
00101   void OnMonitorEvaluationDone(const long status, const std::string& sComment, void* pSender, long threadID);
00102   void OnOnMonitorNextAdaptation(const long status, const std::string& sComment, void* pSender, long threadID);
00103   void OnOnMonitorEvaluationFailed(const long status, const std::string& sComment, void* pSender, long threadID);
00104 
00105   static ITK_THREAD_RETURN_TYPE ThreadExecution( void *arg );
00106 
00107 private:
00108   SetupOptimizationMultiThreadMetric(const Self&); //purposely not implemented
00109   void operator=(const Self&); //purposely not implemented
00110 };
00111 
00112 } // end namespace FREE
00113 
00114 #ifndef ITK_MANUAL_INSTANTIATION
00115 #include "freSetupOptimizationMultiThreadMetric.txx"
00116 #endif
00117 
00118 #endif
00119 
00120 
00121 

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