IGSTK
/tmp/buildd/igstk-4.4.0/Source/igstkOpenIGTLinkVideoImager.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Image Guided Surgery Software Toolkit
00004   Module:    $RCSfile: igstkOpenIGTLinkVideoImager.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-06-18 18:40:55 $
00007   Version:   $Revision: 1.1 $
00008 
00009   Copyright (c) ISC  Insight Software Consortium.  All rights reserved.
00010   See IGSTKCopyright.txt or http://www.igstk.org/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 
00018 #ifndef __igstkOpenIGTLinkVideoImager_h
00019 #define __igstkOpenIGTLinkVideoImager_h
00020 
00021 #ifdef _MSC_VER
00022 #pragma warning ( disable : 4018 )
00023 //Warning about: identifier was truncated to '255' characters in the debug
00024 //information (MVC6.0 Debug)
00025 #pragma warning( disable : 4284 )
00026 #endif
00027 
00028 #include "igstkVideoImager.h"
00029 #include "igstkOpenIGTLinkVideoImagerTool.h"
00030 #include "igtlServerSocket.h"
00031 #include "igtlImageMessage.h"
00032 
00033 #include <map>
00034 
00035 class vtkImageData;
00036 
00037 namespace igstk {
00038 
00046 class OpenIGTLinkVideoImager : public VideoImager
00047 {
00048 public:
00050   igstkStandardClassTraitsMacro( OpenIGTLinkVideoImager, VideoImager )
00051 
00052   
00053   typedef igtl::ServerSocket     CommunicationType;
00054 
00057   void SetCommunication( CommunicationType *communication );
00058 
00059 protected:
00060 
00061   OpenIGTLinkVideoImager(void);
00062 
00063   virtual ~OpenIGTLinkVideoImager(void);
00064 
00066   typedef VideoImager::ResultType   ResultType;
00067 
00069   virtual ResultType InternalOpen( void );
00070 
00072   virtual ResultType InternalClose( void );
00073 
00075   virtual ResultType InternalStartImaging( void );
00076 
00078   virtual ResultType InternalStopImaging( void );
00079 
00081   virtual ResultType InternalUpdateStatus( void );
00082 
00085   virtual ResultType InternalThreadedUpdateStatus( void );
00086 
00088   virtual ResultType InternalReset( void );
00089 
00091   virtual ResultType VerifyVideoImagerToolInformation(
00092                                                   const VideoImagerToolType * );
00093 
00096   virtual ResultType ValidateSpecifiedFrequency( double frequencyInHz );
00097 
00099   virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
00100 
00102   virtual ResultType RemoveVideoImagerToolFromInternalDataContainers( const
00103                                      VideoImagerToolType * imagerTool );
00104 
00106   virtual ResultType AddVideoImagerToolToInternalDataContainers( const
00107                                      VideoImagerToolType * imagerTool );
00108 
00109 private:
00110 
00111   OpenIGTLinkVideoImager(const Self&);   //purposely not implemented
00112   void operator=(const Self&);   //purposely not implemented
00113 
00116   bool Initialize();
00117 
00119   itk::MutexLock::Pointer  m_BufferLock;
00120 
00122   typedef std::map< std::string, igstk::Frame* >
00123                                              VideoImagerToolFrameContainerType;
00124 
00125   VideoImagerToolFrameContainerType          m_ToolFrameBuffer;
00126 
00128   std::map< std::string, int >  m_ToolStatusContainer;
00129 
00131   CommunicationType::Pointer     m_Communication;
00132   igtl::MessageHeader::Pointer   m_HeaderMsg;
00133   igtl::ImageMessage::Pointer    m_ImgMsg;
00134   igtl::Socket::Pointer          m_Socket;
00135 };
00136 
00137 }
00138 
00139 #endif //__igstk_OpenIGTLinkVideoImager_h_