NorMIT-nav  22.09
An IGT application
cxVideoConnection.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 CXOPENIGTLINKRTSOURCE_H_
12 #define CXOPENIGTLINKRTSOURCE_H_
13 
14 #include "org_custusx_core_video_Export.h"
15 
16 #include <vector>
17 #include <map>
18 #include <boost/array.hpp>
19 #include "cxForwardDeclarations.h"
20 
21 typedef vtkSmartPointer<class vtkImageImport> vtkImageImportPtr;
22 typedef vtkSmartPointer<class vtkImageAlgorithm> vtkImageAlgorithmPtr;
23 typedef boost::shared_ptr<QThread> QThreadPtr;
24 
25 namespace cx
26 {
33 typedef boost::shared_ptr<class ProbeDefinition> ProbeDefinitionPtr;
34 typedef boost::shared_ptr<class StreamerService> StreamerServicePtr;
35 typedef boost::shared_ptr<class ImageReceiverThread> ImageReceiverThreadPtr;
36 typedef boost::shared_ptr<class BasicVideoSource> BasicVideoSourcePtr;
37 typedef boost::shared_ptr<class VideoServiceBackend> VideoServiceBackendPtr;
38 
54 class org_custusx_core_video_EXPORT VideoConnection : public QObject
55 {
56  Q_OBJECT
57 
58 public:
59  explicit VideoConnection(VideoServiceBackendPtr backend);
60  virtual ~VideoConnection();
61  virtual bool isConnected() const;
62  void disconnectServer();
63  void runDirectLinkClient(StreamerServicePtr service);
64  std::vector<VideoSourcePtr> getVideoSources();
65 
66 signals:
67  bool connected(bool);
68  void fps(QString source, int fps);
69  void videoSourcesChanged();
70 
71 private slots:
72  void onConnected();
73  void onDisconnected();
74  void imageReceivedSlot();
75  void statusReceivedSlot();
76  void fpsSlot(QString, double fps);
77  void connectVideoToProbe();
78  void useUnusedProbeDefinitionSlot();
79 
80 private:
81  void waitForClientFinished();
82  StreamerServicePtr getStreamerInterface();
83  void updateImage(ImagePtr message); // called by receiving thread when new data arrives.
84  void stopClient();
85  void resetProbe();
86  void updateStatus(ProbeDefinitionPtr message);
87  void startAllSources();
88  void stopAllSources();
89  void removeSourceFromProbe(ToolPtr tool);
90 
91  QPointer<ImageReceiverThread> mClient;
92  QPointer<QThread> mThread;
93 
94  double mFPS;
95  std::vector<ProbeDefinitionPtr> mUnusedProbeDefinitionVector;
96  std::vector<BasicVideoSourcePtr> mSources;
97  VideoServiceBackendPtr mBackend;
98  StreamerServicePtr mStreamerInterface;
99 };
100 typedef boost::shared_ptr<VideoConnection> VideoConnectionPtr;
101 
105 } // namespace cx
106 
107 #endif /* CXOPENIGTLINKRTSOURCE_H_ */
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxForwardDeclarations.h
cx::ProbeDefinitionPtr
boost::shared_ptr< class ProbeDefinition > ProbeDefinitionPtr
Definition: cxImageReceiverThread.h:32
vtkImageAlgorithmPtr
vtkSmartPointer< class vtkImageAlgorithm > vtkImageAlgorithmPtr
Definition: cxVideoConnection.h:22
cx::StreamerServicePtr
boost::shared_ptr< class StreamerService > StreamerServicePtr
Definition: cxPlusConnectWidget.h:26
cx::ImageReceiverThreadPtr
boost::shared_ptr< class ImageReceiverThread > ImageReceiverThreadPtr
Definition: cxImageReceiverThread.h:41
QThreadPtr
boost::shared_ptr< QThread > QThreadPtr
Definition: cxVideoConnection.h:23
cx::ImagePtr
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
cx::VideoConnectionPtr
boost::shared_ptr< VideoConnection > VideoConnectionPtr
Definition: cxVideoConnection.h:100
cx::BasicVideoSourcePtr
boost::shared_ptr< class BasicVideoSource > BasicVideoSourcePtr
Definition: cxPlaybackUSAcquisitionVideo.h:27
cx::ToolPtr
boost::shared_ptr< class Tool > ToolPtr
Definition: cxVideoConnectionWidget.h:43
vtkImageImportPtr
vtkSmartPointer< class vtkImageImport > vtkImageImportPtr
Definition: cxVideoConnection.h:21
cx::VideoConnection
Represent one video grabber connection.
Definition: cxVideoConnection.h:54
cx::VideoServiceBackendPtr
boost::shared_ptr< class VideoServiceBackend > VideoServiceBackendPtr
Definition: cxPlaybackUSAcquisitionVideo.h:28