Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
QmitkTrackingDeviceConfigurationWidget.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QmitkTrackingDeviceConfigurationWidget_h
14 #define QmitkTrackingDeviceConfigurationWidget_h
15 
16 #include <QWidget>
17 #include <QThread>
18 #include "MitkIGTUIExports.h"
19 #include "ui_QmitkTrackingDeviceConfigurationWidgetControls.h"
22 
23 
40 class MITKIGTUI_EXPORT QmitkTrackingDeviceConfigurationWidget : public QWidget
41 {
42  Q_OBJECT
43 
44 public:
45  static const std::string VIEW_ID;
46 
47  QmitkTrackingDeviceConfigurationWidget(QWidget* parent = nullptr, Qt::WindowFlags f = nullptr);
49 
50  /* @return Returns the current configurated tracking device. If the user didn't finished the
51  * configuration process or if there is an error during configuration nullptr is returned.
52  */
53  mitk::TrackingDevice::Pointer GetTrackingDevice();
54 
59  void OnToolStorageChanged();
60 
61 signals:
62 
63  /* @brief This signal is sent if the tracking device was changed. */
64  void TrackingDeviceSelectionChanged();
65 
66 public slots:
71  void OnConnected(bool _success);
76  void OnDisconnected(bool _success);
77 
82  void OnStartTracking(bool _success);
87  void OnStopTracking(bool _success);
88 
89 protected:
90 
92  virtual void CreateConnections();
93 
94  virtual void CreateQtPartControl(QWidget *parent);
95 
96  Ui::QmitkTrackingDeviceConfigurationWidgetControls* m_Controls;
97 
98  // key is port name (e.g. "COM1", "/dev/ttyS0"), value will be filled with the type of tracking device at this port
99  typedef QMap<QString, mitk::TrackingDeviceType> PortDeviceMap;
100 
101  //######################### internal help methods #######################################
102  void ResetOutput();
103  void AddOutput(std::string s);
104 
105  void StoreUISettings();
106  void LoadUISettings();
107 
108  /* @brief This method is called when the user clicks on "Refresh Selection" (m_RefreshTrackingDeviceCollection).
109  It then sets the correct widget for the selected tracking device.*/
110  void RefreshTrackingDeviceCollection();
111 
112  protected slots:
113  /* @brief This method is called when the user changes the selection of the trackingdevice (m_trackingDeviceChooser).
114  It then sets the correct widget for the selected tracking device.*/
115  void TrackingDeviceChanged();
116 
117 private:
119 
120  std::string GetCurrentDeviceName(void) const;
121 
122  QmitkAbstractTrackingDeviceWidget* GetWidget(const std::string& deviceName) const;
123 
127  std::map<std::string, int> m_DeviceToWidgetIndexMap;
128 
129 };
130 
131 #endif
PERSISTENCE_GET_SERVICE_METHOD_MACRO
#define PERSISTENCE_GET_SERVICE_METHOD_MACRO
Definition: mitkIPersistenceService.h:135
QmitkTrackingDeviceConfigurationWidget::VIEW_ID
static const std::string VIEW_ID
Definition: QmitkTrackingDeviceConfigurationWidget.h:45
QmitkTrackingDeviceConfigurationWidget::m_Controls
Ui::QmitkTrackingDeviceConfigurationWidgetControls * m_Controls
Definition: QmitkTrackingDeviceConfigurationWidget.h:96
QmitkTrackingDeviceConfigurationWidget
An object of this class offers an UI to configurate a tracking device. If the user finished the confi...
Definition: QmitkTrackingDeviceConfigurationWidget.h:40
QmitkTrackingDeviceConfigurationWidget::PortDeviceMap
QMap< QString, mitk::TrackingDeviceType > PortDeviceMap
Definition: QmitkTrackingDeviceConfigurationWidget.h:99
mitkTrackingDeviceTypeCollection.h
mitkTrackingDeviceWidgetCollection.h
QmitkAbstractTrackingDeviceWidget
Abstract class to configure a tracking device. Inherited widgets should be registered in the Microser...
Definition: QmitkAbstractTrackingDeviceWidget.h:52