NorMIT-nav  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_ */
cx::TestVideoSource::isConnected
virtual bool isConnected() const
return true when a connection to the data source is established.
Definition: cxTestVideoSource.h:62
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::VideoSource
video source interface.
Definition: cxVideoSource.h:43
vtkImageDataPtr
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
Definition: cxVideoConnectionWidget.h:30
vtkImageImportPtr
vtkSmartPointer< class vtkImageImport > vtkImageImportPtr
Definition: cxTestVideoSource.h:25
cx::TestVideoSource::getInfoString
virtual QString getInfoString() const
an information text intended to be visible along with the data stream at all times
Definition: cxTestVideoSource.h:55
cx::TestVideoSource::validData
virtual bool validData() const
return true is data stream is ok to display. This is a heuristic based on the data rate.
Definition: cxTestVideoSource.h:61
cxVideoSource.h
cx::TestVideoSource::setConnected
virtual void setConnected(bool state)
Definition: cxTestVideoSource.h:65
cx::TestVideoSource::getName
virtual QString getName()
Definition: cxTestVideoSource.h:50
cx::TimeInfo
Definition: cxData.h:43
cx::TestVideoSource::getUid
virtual QString getUid()
Definition: cxTestVideoSource.h:49
cx::TestVideoSource
test video source generator
Definition: cxTestVideoSource.h:41
cx::TestVideoSource::setValidData
virtual void setValidData(bool valid)
Definition: cxTestVideoSource.h:66
vtkImageImportPtr
vtkSmartPointer< class vtkImageImport > vtkImageImportPtr
Definition: cxVideoConnection.h:21
vtkImageDataPtr
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
Definition: cxTestVideoSource.h:24
cx::TestVideoSource::isStreaming
virtual bool isStreaming() const
return true when the source is streaming data.
Definition: cxTestVideoSource.h:63
cx::TestVideoSource::getStatusString
virtual QString getStatusString() const
status text describing the stream state, display instead of stream when the stream is invalid.
Definition: cxTestVideoSource.h:56
cx::TestVideoSourcePtr
boost::shared_ptr< class TestVideoSource > TestVideoSourcePtr
Definition: cxForwardDeclarations.h:101