Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef QMITKTRACKINGDEVICECONFIGURATIONWIDGET_H
18 #define QMITKTRACKINGDEVICECONFIGURATIONWIDGET_H
19 
20 #include <QWidget>
21 #include <QThread>
22 #include "MitkIGTUIExports.h"
23 #include "ui_QmitkTrackingDeviceConfigurationWidgetControls.h"
26 
43 class MITKIGTUI_EXPORT QmitkTrackingDeviceConfigurationWidget : public QWidget
44 {
45  Q_OBJECT
46 
47 public:
48  static const std::string VIEW_ID;
49 
50  QmitkTrackingDeviceConfigurationWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
52 
53  /* @return Returns the current configurated tracking device. If the user didn't finished the
54  * configuration process or if there is an error during configuration NULL is returned.
55  */
56  mitk::TrackingDevice::Pointer GetTrackingDevice();
57 
58 signals:
59 
60  /* @brief This signal is sent if the tracking device was changed. */
61  void TrackingDeviceSelectionChanged();
62 
63 protected:
64 
66  virtual void CreateConnections();
67 
68  virtual void CreateQtPartControl(QWidget *parent);
69 
70  Ui::QmitkTrackingDeviceConfigurationWidgetControls* m_Controls;
71 
73 
74  // key is port name (e.g. "COM1", "/dev/ttyS0"), value will be filled with the type of tracking device at this port
75  typedef QMap<QString, mitk::TrackingDeviceType> PortDeviceMap;
76 
77  //######################### internal help methods #######################################
78  void ResetOutput();
79  void AddOutput(std::string s);
80  mitk::TrackingDevice::Pointer ConstructTrackingDevice();
81 
82  void StoreUISettings();
83  void LoadUISettings();
84 
85  /* @brief This method is called when the user clicks on "Refresh Selection" (m_RefreshTrackingDeviceCollection).
86  It then sets the correct widget for the selected tracking device.*/
87  void RefreshTrackingDeviceCollection();
88 
89  protected slots:
90  /* @brief This method is called when the user changes the selection of the trackingdevice (m_trackingDeviceChooser).
91  It then sets the correct widget for the selected tracking device.*/
92  void TrackingDeviceChanged();
93 
94 private:
96 
97  std::string GetCurrentDeviceName(void) const;
98 
99  QmitkAbstractTrackingDeviceWidget* GetWidget(const std::string& deviceName) const;
100 
104  std::map<std::string, int> m_DeviceToWidgetIndexMap;
105 
106 };
107 
108 #endif
itk::SmartPointer< Self > Pointer
QMap< QString, mitk::TrackingDeviceType > PortDeviceMap
Ui::QmitkTrackingDeviceConfigurationWidgetControls * m_Controls
#define PERSISTENCE_GET_SERVICE_METHOD_MACRO
An object of this class offers an UI to configurate a tracking device. If the user finished the confi...
Abstract class to configure a tracking device. Inherited widgets should be registered in the Microser...