NorMIT-nav  22.09
An IGT application
cxBasicVideoSource.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 CXBASICVIDEOSOURCE_H
12 #define CXBASICVIDEOSOURCE_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 #include <boost/array.hpp>
22 class QTimer;
23 
24 #include "cxVideoSource.h"
25 #include "cxForwardDeclarations.h"
26 
27 typedef vtkSmartPointer<class vtkImageData> vtkImageDataPtr;
28 typedef vtkSmartPointer<class vtkImageChangeInformation> vtkImageChangeInformationPtr;
29 
30 namespace cx
31 {
32 
44 class cxResource_EXPORT BasicVideoSource : public VideoSource
45 {
46  Q_OBJECT
47 
48 public:
49  explicit BasicVideoSource(QString uid = "<none>");
50  virtual ~BasicVideoSource();
51 
52  virtual QString getUid();
53  virtual QString getName();
54  virtual vtkImageDataPtr getVtkImageData();
55  virtual double getTimestamp();
56  virtual TimeInfo getAdvancedTimeInfo();
57 
58  virtual QString getInfoString() const { return mInfo; }
59  virtual QString getStatusString() const;
60 
61  virtual void start();
62  virtual void stop();
63 
64  virtual bool validData() const;
65  virtual bool isConnected() const;
66  virtual bool isStreaming() const;
67 
68  virtual void setResolution(double resolution);
69 
70  // extensions:
82  void setInput(ImagePtr input);
83  void setInfoString(QString text) { mInfo = text; }
84  void setStatusString(QString text) { mStatus = text; }
85  void deconfigure() { this->setInput(ImagePtr()); }
89  void overrideTimeout(bool timeout);
90 
91 private slots:
92  void timeout();
93 private:
94  bool mStreaming;
95  QString mInfo;
96  QString mStatus;
97 
98  ImagePtr mEmptyImage;
99  ImagePtr mReceivedImage;
100  vtkImageChangeInformationPtr mRedirecter;
101  bool mTimeout;
102  QTimer* mTimeoutTimer;
103 };
104 
105 typedef boost::shared_ptr<BasicVideoSource> BasicVideoSourcePtr;
106 
107 } // namespace cx
108 
109 #endif // CXBASICVIDEOSOURCE_H
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxForwardDeclarations.h
cx::VideoSource
video source interface.
Definition: cxVideoSource.h:43
vtkImageDataPtr
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
Definition: cxVideoConnectionWidget.h:30
cxVideoSource.h
cx::BasicVideoSource::setInfoString
void setInfoString(QString text)
Definition: cxBasicVideoSource.h:83
cx::TimeInfo
Definition: cxData.h:43
vtkImageChangeInformationPtr
vtkSmartPointer< class vtkImageChangeInformation > vtkImageChangeInformationPtr
Definition: cxBasicVideoSource.h:28
cx::BasicVideoSource
VideoSource controlled by a vtkImageData.
Definition: cxBasicVideoSource.h:44
cx::ImagePtr
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
cx::BasicVideoSourcePtr
boost::shared_ptr< class BasicVideoSource > BasicVideoSourcePtr
Definition: cxPlaybackUSAcquisitionVideo.h:27
vtkImageChangeInformationPtr
vtkSmartPointer< vtkImageChangeInformation > vtkImageChangeInformationPtr
Definition: cxImage.cpp:46
cx::BasicVideoSource::setStatusString
void setStatusString(QString text)
Definition: cxBasicVideoSource.h:84
cx::BasicVideoSource::deconfigure
void deconfigure()
Definition: cxBasicVideoSource.h:85
cx::BasicVideoSource::getInfoString
virtual QString getInfoString() const
an information text intended to be visible along with the data stream at all times
Definition: cxBasicVideoSource.h:58
vtkImageDataPtr
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
Definition: cxBasicVideoSource.h:22