freSessionProcessor.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: freSessionProcessor.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 __freRegistrator_h
00023 #define __freRegistrator_h
00024 
00025 #include "freElementals.h"
00026 #include "freStatistics.h"
00027 #include "freSetup.h"
00028 #include "freControllerCentral.h"
00029 #include "freSessionBuilder.h"
00030 #include "freExceptions.h"
00031 #include "freSessionInfo.h"
00032 
00033 namespace FREE
00034 {
00035 
00043 class SessionProcessor
00044 {
00045 
00046 public:
00047         typedef SessionProcessor Self;
00048   typedef SessionBuilder::GenericMediaType GenericMediaType;
00049   typedef GenericMediaType::Pointer     GenericMediaPointer;
00050 
00051   virtual const char *GetNameOfClass() const
00052         {return "SessionProcessor";};
00053 
00058   void SetSetup(Setup* pSetup);
00059 
00063   inline const Setup* GetSetup() const { return m_pSetup; };
00064   inline Setup* GetSetup() { return m_pSetup; };
00065 
00066         inline SessionInfo* GetSessionInfo() {return m_smpSessionInfo.GetPointer();};
00067 
00073   void SetStatistic(Statistics* pStatistic);
00077   inline const Statistics* GetStatistic() const { return m_pStatistic; };
00078   inline Statistics* GetStatistic() { return m_pStatistic; };
00079 
00080   void DefineOutput(const std::string& sOutputID, const IDPath& idPath);
00081   void ResetOutputs();
00082 
00083   GenericMediaPointer GetOutput(const std::string& sOutputID);
00084 
00085   GenericMediaPointer GetOutput(const IDPath& idPath);
00086 
00087   template <class TMediaType>
00088   typename TMediaType::Pointer GetCastedOutput(const std::string& sOutputID)
00089   {
00090     GenericMediaPointer smpMedia = GetOutput(sOutputID);
00091 
00092     typename TMediaType::Pointer smpCastedMedia;
00093 
00094     try
00095     {
00096       smpCastedMedia = dynamic_cast<TMediaType*>(smpMedia.GetPointer());
00097     }
00098     catchAllNPassMacro("Error while casting output.");
00099     
00100     return smpCastedMedia;
00101   };
00102 
00104   void InitializeSession();
00105 
00106   void Update();
00107   
00108   void ResetSession();
00109 
00110   SessionProcessor();
00111 
00112   virtual ~SessionProcessor();
00113 
00114 protected:
00116   SessionInfo::Pointer m_smpSessionInfo;
00117 
00120   Setup* m_pSetup; // = NULL;
00121 
00124   Statistics* m_pStatistic; // = NULL;
00125 
00126   typedef std::map<std::string, IDPath > MediaIDMapType;
00127 
00128   MediaIDMapType m_MediaMap;
00129 
00130   bool m_bInitialized;
00131 };
00132 
00133 } //End of namespace FREE
00134 
00135 #endif

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