CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxVideoConnectionWidget.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 #ifndef CXIGTLINKWIDGET_H_
13 #define CXIGTLINKWIDGET_H_
14 
15 #include "cxGuiExport.h"
16 
17 #include "cxBaseWidget.h"
18 
19 #include <vector>
20 #include <boost/shared_ptr.hpp>
21 #include <QProcess>
22 #include "cxTransform3D.h"
23 #include "cxForwardDeclarations.h"
24 #include "cxXmlOptionItem.h"
25 #include "cxVisServices.h"
26 
27 class QPushButton;
28 class QComboBox;
29 class QLineEdit;
30 class QStackedWidget;
31 typedef vtkSmartPointer<class vtkImageData> vtkImageDataPtr;
32 
33 namespace cx
34 {
35 class SimulateUSWidget;
36 class FileInputWidget;
37 class StreamerService;
38 class XmlOptionFile;
40 typedef boost::shared_ptr<class VideoConnectionManager> VideoConnectionManagerPtr;
41 typedef boost::shared_ptr<class StringPropertyActiveVideoSource> StringPropertyActiveVideoSourcePtr;
42 typedef boost::shared_ptr<class StringProperty> StringPropertyPtr;
43 typedef boost::shared_ptr<class Tool> ToolPtr;
44 typedef boost::shared_ptr<class VisServices> VisServicesPtr;
45 
56 class cxGui_EXPORT VideoConnectionWidget : public BaseWidget
57 {
58  Q_OBJECT
59 
60 public:
61  VideoConnectionWidget(VisServicesPtr services, QWidget* parent);
62  virtual ~VideoConnectionWidget();
63 
64 protected slots:
65  void toggleConnectServer();
66  void serverStatusChangedSlot();
67  void importStreamImageSlot();
68  void setConnectionMethodAndUpdateGuiForConnectionMethodSlot();
69  void connectionMethodChangedSlot();
70  void onServiceAdded(StreamerService *service);
71  void onServiceRemoved(StreamerService *service);
72 
73 protected:
74  StringPropertyActiveVideoSourcePtr initializeActiveVideoSourceSelector();
75  QFrame* wrapStackedWidgetInAFrame();
76  QPushButton* initializeConnectButton();
77  QPushButton* initializeImportStreamImageButton();
78  QWidget* wrapVerticalStretch(QWidget* input);
79  Transform3D calculate_rMd_ForAProbeImage(ToolPtr probe);
80  QString generateFilename(VideoSourcePtr videoSource);
81  void saveAndImportSnapshot(vtkImageDataPtr input, QString filename, Transform3D rMd);
82 
83  QPushButton* mConnectButton;
85  QVBoxLayout* mToptopLayout;
86  QStackedWidget* mStackedWidget;
87  StringPropertyPtr mConnectionSelector;
88  StringPropertyActiveVideoSourcePtr mActiveVideoSourceSelector;
92 
93  VisServicesPtr mServices;
94 
95 private:
96  QWidget* createStreamerWidget(StreamerService* service);
97  void addServiceToSelector(StreamerService *service);
98  void removeServiceFromSelector(StreamerService *service);
99  void removeServiceWidget(QString name);
100  void addExistingStreamerServices();
101 
102  std::map<QString, QWidget*> mStreamerServiceWidgets;
103  bool mUpdateConnectionInService;
104 };
105 
106 }//end namespace cx
107 
108 #endif /* CXIGTLINKWIDGET_H_ */
boost::shared_ptr< class StringPropertyActiveVideoSource > StringPropertyActiveVideoSourcePtr
DetailedLabeledComboBoxWidget * mConnectionSelectionWidget
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class VideoConnectionManager > VideoConnectionManagerPtr
GUI for setting up a connection to a video stream.
boost::shared_ptr< class StringProperty > StringPropertyPtr
Composite widget for string selection with .
boost::shared_ptr< class VideoSource > VideoSourcePtr
StringPropertyActiveVideoSourcePtr mActiveVideoSourceSelector
Interface for QWidget which handles widgets uniformly for the system.
Definition: cxBaseWidget.h:88
Abstract class. Interface to Streamers.
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
Helper class for xml files used to store ssc/cx data.
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr