Fraxinus  18.10
An IGT application
cxVideoSourceSHM.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 
13 /*
14  * sscVideoSourceSHM.h
15  *
16  * Created on: Oct 10, 2011
17  * Author: franka
18  */
19 
20 #ifndef CXVIDEOSOURCESHM_H_
21 #define CXVIDEOSOURCESHM_H_
22 
23 #include "cxResourceExport.h"
24 
25 #include <map>
26 #include <stdint.h>
27 
28 #include <boost/shared_ptr.hpp>
29 
30 #include "vtkSmartPointer.h"
31 
32 #include <QObject>
33 #include <QDateTime>
34 
35 #include "cxVideoSource.h"
36 #include "cxSharedMemory.h"
37 
38 typedef vtkSmartPointer<class vtkImageImport> vtkImageImportPtr;
39 
40 // Forward declaration
41 class QTimer;
42 
43 namespace cx
44 {
45 
52 class cxResource_EXPORT VideoSourceSHM : public VideoSource
53 {
54  Q_OBJECT
55 
56 public:
57 
58  VideoSourceSHM(int width = 0, int height = 0, int depth = 24);
59  virtual ~VideoSourceSHM();
60 
61  int width() const { return mImageWidth; }
62  int height() const { return mImageHeight; }
63  int depth() const { return mImageColorDepth; }
64 
65  virtual QString getUid();
66  virtual QString getName();
67  virtual vtkImageDataPtr getVtkImageData();
68  virtual double getTimestamp();
69 
70  virtual QString getInfoString() const;
71  virtual QString getStatusString() const;
72 
73  virtual void start();
74  virtual void stop();
75 
76  virtual bool validData() const;
77  virtual bool isConnected() const;
78  virtual bool isStreaming() const;
79 
80  void connectServer(const QString& key);
81  void disconnectServer();
82  virtual void setResolution(double resolution);
83 
84 protected:
85  void update();
86 
87 protected:
91 
92 private:
93 
94  SharedMemoryClient mSource;
95 
96  vtkImageDataPtr mImageData;
97  vtkImageImportPtr mImageImport;
98 
99  double mTimeStamp;
100 
101  bool mConnected;
102  bool mStreaming;
103  bool mImportInitialized;
104  bool mStartWhenConnected;
105 
106  QTimer* mPollTimer;
107 
108 private slots:
109 
110  void serverPollSlot();
111 };
112 
113 typedef boost::shared_ptr<VideoSourceSHM> VideoSourceSHMPtr;
114 
115 } // namespace cx
116 
117 #endif /* CXVIDEOSOURCESHM_H_ */
vtkSmartPointer< class vtkImageImport > vtkImageImportPtr
Shared Memory Client.
boost::shared_ptr< VideoSourceSHM > VideoSourceSHMPtr
video source interface.
Definition: cxVideoSource.h:43
vtkSmartPointer< class vtkImageImport > vtkImageImportPtr
VideoSource for connecting to shared memory.
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
Namespace for all CustusX production code.