Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
QmitkAbstractTrackingDeviceWidget.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 QmitkAbstractTrackingDeviceWidget_h
14 #define QmitkAbstractTrackingDeviceWidget_h
15 
16 #include <QWidget>
17 #include "MitkIGTUIExports.h"
18 #include "mitkTrackingDevice.h"
19 
21 
23 
24 //itk headers
25 
52 class MITKIGTUI_EXPORT QmitkAbstractTrackingDeviceWidget : public QWidget
53 {
54  Q_OBJECT
55 
56 public:
57  static const std::string VIEW_ID;
58 
59  QmitkAbstractTrackingDeviceWidget(QWidget* parent = nullptr, Qt::WindowFlags f = nullptr);
60 
62 
68  QmitkAbstractTrackingDeviceWidget* CloneForQt(QWidget* parent = nullptr) const;
69 
74  virtual void Initialize() = 0;
75 
76  bool IsInitialized() const { return isInitialized; }
77 
78 signals:
79  void ConnectionTested(bool connected, QString output);
80 
81  protected slots:
82  void TestConnectionFinished(bool connected, QString output);
83 
84  /* @brief This method is called when the user presses the button "test connection". The method will then create a temporary tracking device,
85  * try to open a connection and start tracking. The user can see the result of the connection test on the small output window.
86  */
87  void TestConnection();
88 
89 private:
91  void CreateConnections();
92 
93 protected:
95  void InitializeSuperclassWidget();
96 
99 
104  virtual QmitkAbstractTrackingDeviceWidget* Clone(QWidget* parent = nullptr) const = 0;
105 
106 public:
110  virtual void ResetOutput() {}
114  virtual void AddOutput(std::string) {}
115  virtual mitk::TrackingDevice::Pointer GetTrackingDevice() = 0;
116 
120  virtual void StoreUISettings() {}
121 
125  virtual void LoadUISettings() {}
126 
132  virtual bool IsDeviceInstalled() { return true; }
133 
138  virtual void OnConnected(bool) {}
143  virtual void OnDisconnected(bool) {}
144 
149  virtual void OnStartTracking(bool) {}
154  virtual void OnStopTracking(bool) {}
159  virtual void OnToolStorageChanged() {}
160 
161 
162  std::string m_ErrorMessage;
163 
164 private:
168  bool isInitialized;
169 };
170 
171 #endif
PERSISTENCE_GET_SERVICE_METHOD_MACRO
#define PERSISTENCE_GET_SERVICE_METHOD_MACRO
Definition: mitkIPersistenceService.h:135
QmitkAbstractTrackingDeviceWidget::m_TestConnectionWorkerThread
QThread * m_TestConnectionWorkerThread
Definition: QmitkAbstractTrackingDeviceWidget.h:98
QmitkAbstractTrackingDeviceWidget::IsInitialized
bool IsInitialized() const
Definition: QmitkAbstractTrackingDeviceWidget.h:76
QmitkTrackingDeviceConfigurationWidgetConnectionWorker.h
QmitkAbstractTrackingDeviceWidget::OnDisconnected
virtual void OnDisconnected(bool)
This function is called, when in the TrackingToolboxView "Disconnect" was clicked and the device is s...
Definition: QmitkAbstractTrackingDeviceWidget.h:143
mitkIPersistenceService.h
QmitkAbstractTrackingDeviceWidget::AddOutput
virtual void AddOutput(std::string)
Optional method to add output to a small screen in the trackingToolbox (see QmitkNDIPolarisWidget)
Definition: QmitkAbstractTrackingDeviceWidget.h:114
QmitkAbstractTrackingDeviceWidget::IsDeviceInstalled
virtual bool IsDeviceInstalled()
Optional method to investigate if drivers etc for your device are installed. The default value is "tr...
Definition: QmitkAbstractTrackingDeviceWidget.h:132
QmitkAbstractTrackingDeviceWidget::OnToolStorageChanged
virtual void OnToolStorageChanged()
This function is called, when anything in the ToolStorage changed, e.g. AddTool or EditTool....
Definition: QmitkAbstractTrackingDeviceWidget.h:159
QmitkAbstractTrackingDeviceWidget::ResetOutput
virtual void ResetOutput()
Optional method to add output to a small screen in the trackingToolbox (see QmitkNDIPolarisWidget)
Definition: QmitkAbstractTrackingDeviceWidget.h:110
QmitkAbstractTrackingDeviceWidget::OnConnected
virtual void OnConnected(bool)
This function is called, when in the TrackingToolboxView "Connect" was clicked and the device is succ...
Definition: QmitkAbstractTrackingDeviceWidget.h:138
QmitkAbstractTrackingDeviceWidget::VIEW_ID
static const std::string VIEW_ID
Definition: QmitkAbstractTrackingDeviceWidget.h:57
QmitkTrackingDeviceConfigurationWidgetConnectionWorker
Definition: QmitkTrackingDeviceConfigurationWidgetConnectionWorker.h:30
QmitkAbstractTrackingDeviceWidget::m_TestConnectionWorker
QmitkTrackingDeviceConfigurationWidgetConnectionWorker * m_TestConnectionWorker
Definition: QmitkAbstractTrackingDeviceWidget.h:97
QmitkAbstractTrackingDeviceWidget::OnStopTracking
virtual void OnStopTracking(bool)
This function is called, when in the TrackingToolboxView "Stop Tracking" was clicked and the device s...
Definition: QmitkAbstractTrackingDeviceWidget.h:154
QmitkAbstractTrackingDeviceWidget::OnStartTracking
virtual void OnStartTracking(bool)
This function is called, when in the TrackingToolboxView "Start Tracking" was clicked and the device ...
Definition: QmitkAbstractTrackingDeviceWidget.h:149
QmitkAbstractTrackingDeviceWidget::StoreUISettings
virtual void StoreUISettings()
Optional method to store and load settings of your widget (see QmitkNDIPolarisWidget)
Definition: QmitkAbstractTrackingDeviceWidget.h:120
QmitkAbstractTrackingDeviceWidget::m_ErrorMessage
std::string m_ErrorMessage
current problem description
Definition: QmitkAbstractTrackingDeviceWidget.h:162
mitkTrackingDevice.h
QmitkAbstractTrackingDeviceWidget::LoadUISettings
virtual void LoadUISettings()
Optional method to store and load settings of your widget (see QmitkNDIPolarisWidget)
Definition: QmitkAbstractTrackingDeviceWidget.h:125
QmitkAbstractTrackingDeviceWidget
Abstract class to configure a tracking device. Inherited widgets should be registered in the Microser...
Definition: QmitkAbstractTrackingDeviceWidget.h:52