00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date: 2009-05-12 19:14:45 +0200 (Di, 12 Mai 2009) $ 00006 Version: $Revision: 1.12 $ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #ifndef QMITKTRACKINGDEVICECONFIGURATIONWIDGET_H 00019 #define QMITKTRACKINGDEVICECONFIGURATIONWIDGET_H 00020 00021 #include <QWidget> 00022 #include "MitkIGTUIExports.h" 00023 #include "ui_QmitkTrackingDeviceConfigurationWidgetControls.h" 00024 #include "mitkTrackingDevice.h" 00025 00044 class MitkIGTUI_EXPORT QmitkTrackingDeviceConfigurationWidget : public QWidget 00045 { 00046 Q_OBJECT 00047 00048 public: 00049 static const std::string VIEW_ID; 00050 00051 QmitkTrackingDeviceConfigurationWidget(QWidget* parent = 0, Qt::WindowFlags f = 0); 00052 ~QmitkTrackingDeviceConfigurationWidget(); 00053 00054 /* @return Returns the current configurated tracking device. If the user didn't finished the 00055 * configuration process NULL is returned. 00056 */ 00057 mitk::TrackingDevice::Pointer GetTrackingDevice(); 00058 00059 /* @brief Resets the UI to allow the user for configurating a new tracking device. 00060 */ 00061 void Reset(); 00062 00063 /* @brief Sets our unsets the possibility to reset the UI and start 00064 * a new configuration by the user. Concretely this means the 00065 * button "reset" is shown or not. 00066 */ 00067 void EnableUserReset(bool enable); 00068 00069 signals: 00070 00071 /* @brief This signal is sent if the user has finished the configuration of the tracking device. 00072 * The device is now availiable if the method GetTrackingDevice() is called. The tracking 00073 * device you'll get is completly configurated but no tools are added yet. 00074 */ 00075 void TrackingDeviceConfigurationFinished(); 00076 00077 /* @brief This signal is sent if the UI was reseted and the user is required to configurate 00078 * a new tracking device. 00079 */ 00080 void TrackingDeviceConfigurationReseted(); 00081 00082 protected: 00083 00085 virtual void CreateConnections(); 00086 00087 virtual void CreateQtPartControl(QWidget *parent); 00088 00089 Ui::QmitkTrackingDeviceConfigurationWidgetControls* m_Controls; 00090 00091 std::stringstream m_output; 00092 00093 mitk::TrackingDevice::Pointer m_TrackingDevice; 00094 bool m_TrackingDeviceConfigurated; 00095 00096 //######################### internal help methods ####################################### 00097 void ResetOutput(); 00098 void AddOutput(std::string s); 00099 mitk::TrackingDevice::Pointer ConstructTrackingDevice(); 00100 00101 protected slots: 00102 /* @brief This method is called when the user changes the selection of the trackingdevice (m_trackingDeviceChooser). 00103 It then sets the correct widget for the selected tracking device.*/ 00104 void TrackingDeviceChanged(); 00105 00106 /* @brief This method is called when the user presses the button "test connection". The method will then create a temporary tracking device, 00107 * try to open a connection and start tracking. The user can see the result of the connection test on the small output window. 00108 */ 00109 void TestConnection(); 00110 00111 /* @brief This method is called when the user presses the button "finished". A new tracking device will be created in this case and will then 00112 * then be availiable by calling GetTrackingDevice(). Also a signal TrackingDeviceConfigurationFinished() will be emitted. After this the 00113 * UI will be disablet until the widget is reseted to configure a new tracking device. 00114 */ 00115 void Finished(); 00116 00117 /* @brief This method is called when the user presses the button "reset". He can configure a new tracking device then. The signal 00118 * TrackingDeviceConfigurationReseted() will be emitted if this method is called. The method GetTrackingDevice() will return 00119 * NULL until a new tracking device is configured. 00120 */ 00121 void ResetByUser(); 00122 00123 /* @return Returns a configured NDI 5D tracking device. Unfortunately the NDI 5D tracking device is not yet in the open source part 00124 * so this method only returns NULL at the moment. 00125 */ 00126 virtual mitk::TrackingDevice::Pointer ConfigureNDI5DTrackingDevice(); 00127 00128 /* @return Returns a configured NDI 6D tracking device. 00129 * The type (which means Aurora/Polaris) will not be set in the returnvalue. You have to this later. 00130 */ 00131 mitk::TrackingDevice::Pointer ConfigureNDI6DTrackingDevice(); 00132 00133 }; 00134 #endif