00001 /*========================================================================= 00002 00003 Program: Image Guided Surgery Software Toolkit 00004 Module: $RCSfile: igstkWebcamWinVideoImager.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-06-18 20:03:38 $ 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 __igstkWebcamWinVideoImager_h 00019 #define __igstkWebcamWinVideoImager_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 #include "igstkConfigure.h" 00028 00029 #include "igstkVideoImager.h" 00030 #include "igstkWebcamWinVideoImagerTool.h" 00031 00032 #include <sys/types.h> 00033 #include <stdio.h> 00034 #include <map> 00035 #include <signal.h> 00036 00037 #include "cv.h" 00038 #include "highgui.h" 00039 00040 namespace igstk { 00041 00049 class WebcamWinVideoImager : public VideoImager 00050 { 00051 public: 00053 igstkStandardClassTraitsMacro( WebcamWinVideoImager, VideoImager ) 00054 00055 public: 00056 00058 igstkGetMacro( NumberOfTools, unsigned int ); 00059 00060 protected: 00061 00062 WebcamWinVideoImager(void); 00063 00064 virtual ~WebcamWinVideoImager(void); 00065 00067 typedef VideoImager::ResultType ResultType; 00068 00070 virtual ResultType InternalOpen( void ); 00071 00073 virtual ResultType InternalClose( void ); 00074 00076 virtual ResultType InternalStartImaging( void ); 00077 00079 virtual ResultType InternalStopImaging( void ); 00080 00082 virtual ResultType InternalUpdateStatus( void ); 00083 00086 virtual ResultType InternalThreadedUpdateStatus( void ); 00087 00089 virtual ResultType InternalReset( void ); 00090 00092 virtual ResultType VerifyVideoImagerToolInformation( 00093 const VideoImagerToolType * ); 00094 00097 virtual ResultType ValidateSpecifiedFrequency( double frequencyInHz ); 00098 00100 virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const; 00101 00103 virtual ResultType RemoveVideoImagerToolFromInternalDataContainers( const 00104 VideoImagerToolType * imagerTool ); 00105 00107 virtual ResultType AddVideoImagerToolToInternalDataContainers( const 00108 VideoImagerToolType * imagerTool ); 00109 00110 private: 00111 00112 WebcamWinVideoImager(const Self&); //purposely not implemented 00113 void operator=(const Self&); //purposely not implemented 00114 00116 bool Initialize(); 00117 00119 itk::MutexLock::Pointer m_BufferLock; 00120 00122 unsigned int m_NumberOfTools; 00123 00125 typedef std::map< std::string, igstk::Frame* > 00126 VideoImagerToolFrameContainerType; 00127 00128 typedef igstk::Frame FrameType; 00129 VideoImagerToolFrameContainerType m_ToolFrameBuffer; 00130 00132 std::map< std::string, int > m_ToolStatusContainer; 00133 00136 public: 00138 static itk::MutexLock::Pointer m_FrameBufferLock; 00139 00140 #ifdef IGSTK_USE_OpenCV 00141 CvCapture *m_Capture; 00142 IplImage *m_Cvframe; 00143 #endif 00144 }; 00145 00146 } // namespace igstk 00147 00148 #endif //__igstk_WebcamWinVideoImager_h_