IGSTK
igstkWebcamWinVideoImager.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Image Guided Surgery Software Toolkit
4  Module: $RCSfile: igstkWebcamWinVideoImager.h,v $
5  Language: C++
6  Date: $Date: 2009-06-18 20:03:38 $
7  Version: $Revision: 1.1 $
8 
9  Copyright (c) ISC Insight Software Consortium. All rights reserved.
10  See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 
18 #ifndef __igstkWebcamWinVideoImager_h
19 #define __igstkWebcamWinVideoImager_h
20 
21 #ifdef _MSC_VER
22 #pragma warning ( disable : 4018 )
23 //Warning about: identifier was truncated to '255' characters in the debug
24 //information (MVC6.0 Debug)
25 #pragma warning( disable : 4284 )
26 #endif
27 #include "igstkConfigure.h"
28 
29 #include "igstkVideoImager.h"
31 
32 #include <sys/types.h>
33 #include <stdio.h>
34 #include <map>
35 #include <signal.h>
36 
37 #include "cv.h"
38 #include "highgui.h"
39 
40 namespace igstk {
41 
50 {
51 public:
54 
55 public:
56 
58  igstkGetMacro( NumberOfTools, unsigned int );
59 
60 protected:
61 
63 
64  virtual ~WebcamWinVideoImager(void);
65 
68 
70  virtual ResultType InternalOpen( void );
71 
73  virtual ResultType InternalClose( void );
74 
76  virtual ResultType InternalStartImaging( void );
77 
79  virtual ResultType InternalStopImaging( void );
80 
82  virtual ResultType InternalUpdateStatus( void );
83 
86  virtual ResultType InternalThreadedUpdateStatus( void );
87 
89  virtual ResultType InternalReset( void );
90 
92  virtual ResultType VerifyVideoImagerToolInformation(
93  const VideoImagerToolType * );
94 
97  virtual ResultType ValidateSpecifiedFrequency( double frequencyInHz );
98 
100  virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
101 
103  virtual ResultType RemoveVideoImagerToolFromInternalDataContainers( const
104  VideoImagerToolType * imagerTool );
105 
107  virtual ResultType AddVideoImagerToolToInternalDataContainers( const
108  VideoImagerToolType * imagerTool );
109 
110 private:
111 
112  WebcamWinVideoImager(const Self&); //purposely not implemented
113  void operator=(const Self&); //purposely not implemented
114 
116  bool Initialize();
117 
119  itk::MutexLock::Pointer m_BufferLock;
120 
122  unsigned int m_NumberOfTools;
123 
125  typedef std::map< std::string, igstk::Frame* >
126  VideoImagerToolFrameContainerType;
127 
128  typedef igstk::Frame FrameType;
129  VideoImagerToolFrameContainerType m_ToolFrameBuffer;
130 
132  std::map< std::string, int > m_ToolStatusContainer;
133 
136 public:
138  static itk::MutexLock::Pointer m_FrameBufferLock;
139 
140 #ifdef IGSTK_USE_OpenCV
141  CvCapture *m_Capture;
142  IplImage *m_Cvframe;
143 #endif
144 };
145 
146 } // namespace igstk
147 
148 #endif //__igstk_WebcamWinVideoImager_h_
virtual ResultType InternalStartImaging(void)
Put the imaging device into imaging mode.
virtual ResultType InternalOpen(void)
Open communication with the imaging device.
igstkStandardAbstractClassTraitsMacro(VideoImager, Object) public typedef VideoImagerTool VideoImagerToolType
Macro with standard traits declarations.
#define igstkGetMacro(name, type)
Get built-in type.
Definition: igstkMacros.h:105
static itk::MutexLock::Pointer m_FrameBufferLock
Members and functions for communication with the webcam.
Base class for all the IGSTK classes.
Definition: igstkObject.h:40
virtual ResultType ValidateSpecifiedFrequency(double frequencyInHz)
The "ValidateSpecifiedFrequency" method checks if the specified frequency is valid for the imaging de...
::itk::SmartPointer< Self > Pointer
Definition: igstkObject.h:50
virtual ResultType InternalUpdateStatus(void)
Update the status and the transforms for all VideoImagerTools.
virtual ResultType AddVideoImagerToolToInternalDataContainers(const VideoImagerToolType *imagerTool)
Add imager tool entry to internal containers.
virtual ResultType InternalStopImaging(void)
Take the imaging device out of imaging mode.
Abstract superclass for concrete IGSTK VideoImager classes.
virtual ResultType InternalReset(void)
Reset the imaging device to put it back to its original state.
igstkStandardClassTraitsMacro(WebcamWinVideoImager, VideoImager) public
Macro with standard traits declarations.
virtual void PrintSelf(std::ostream &os, itk::Indent indent) const
Print object information.
virtual ResultType InternalThreadedUpdateStatus(void)
Update the status and the frames.
This derivation of the VideoImager class provides communication to a Webcam in Windows.
virtual ResultType VerifyVideoImagerToolInformation(const VideoImagerToolType *)
Verify imager tool information.
Frame from an external input device.
Definition: igstkFrame.h:49
virtual ResultType InternalClose(void)
Close communication with the imaging device.
virtual ResultType RemoveVideoImagerToolFromInternalDataContainers(const VideoImagerToolType *imagerTool)
Remove imager tool entry from internal containers.