CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxTestVideoSource.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 #ifndef CXTESTVIDEOSOURCE_H_
12 #define CXTESTVIDEOSOURCE_H_
13 
14 #include "cxResourceExport.h"
15 
16 #include "vtkSmartPointer.h"
17 #include <stdint.h>
18 #include <boost/shared_ptr.hpp>
19 #include <QObject>
20 #include <QDateTime>
21 
22 #include "cxVideoSource.h"
23 
24 typedef vtkSmartPointer<class vtkImageData> vtkImageDataPtr;
25 typedef vtkSmartPointer<class vtkImageImport> vtkImageImportPtr;
26 class QTimer;
27 
28 namespace cx
29 {
30 
41 class cxResource_EXPORT TestVideoSource : public VideoSource
42 {
43  Q_OBJECT
44 
45 public:
46  TestVideoSource( QString uid, QString name, int width, int height);
47  virtual ~TestVideoSource();
48 
49  virtual QString getUid() { return mUid; }
50  virtual QString getName() { return mName; }
51  virtual vtkImageDataPtr getVtkImageData();
52  virtual double getTimestamp();
53  virtual TimeInfo getAdvancedTimeInfo();
54 
55  virtual QString getInfoString() const { return QString("TestVideo Info"); }
56  virtual QString getStatusString() const { return QString("TestVideo Status"); }
57 
58  virtual void start();
59  virtual void stop();
60 
61  virtual bool validData() const { return isStreaming() && mInitialized && mValidData; }
62  virtual bool isConnected() const { return mConnected; }
63  virtual bool isStreaming() const { return mConnected && mStreaming; }
64 
65  virtual void setConnected(bool state) { mConnected = state; }
66  virtual void setValidData(bool valid) { mValidData = valid; }
67 
68  virtual void setResolution(double resolution);
69 private slots:
70  void processBuffer();
71 private:
72  bool mConnected;
73  bool mValidData;
74  QString mUid;
75  QString mName;
76  int mFrames;
77  double mResolution;
78  vtkImageImportPtr mImageImport;
79  int mWidth;
80  int mHeight;
81  bool mStreaming;
82  QTimer *mImageTimer;
83  uint8_t *mBuffer;
84  bool mInitialized;
85 };
86 typedef boost::shared_ptr<TestVideoSource> TestVideoSourcePtr;
87 
88 } // namespace cx
89 
90 #endif /* CXTESTVIDEOSOURCE_H_ */
vtkSmartPointer< class vtkImageImport > vtkImageImportPtr
test video source generator
virtual bool isStreaming() const
return true when the source is streaming data.
virtual QString getInfoString() const
an information text intended to be visible along with the data stream at all times ...
virtual bool isConnected() const
return true when a connection to the data source is established.
boost::shared_ptr< class TestVideoSource > TestVideoSourcePtr
virtual bool validData() const
return true is data stream is ok to display. This is a heuristic based on the data rate...
virtual void setConnected(bool state)
virtual QString getName()
virtual QString getUid()
video source interface.
Definition: cxVideoSource.h:43
vtkSmartPointer< class vtkImageImport > vtkImageImportPtr
virtual void setValidData(bool valid)
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
virtual QString getStatusString() const
status text describing the stream state, display instead of stream when the stream is invalid...
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
Namespace for all CustusX production code.