Medical Imaging Interaction Toolkit  2018.4.99-08619e4f
Medical Imaging Interaction Toolkit
QmitkAbstractTrackingDeviceWidget Class Referenceabstract

Abstract class to configure a tracking device. Inherited widgets should be registered in the Microservice (TrackingDeviceCollectionWidget), If done so, they will be included in the QmitkTrackingDeviceConfigurationWidget of the Tracking Toolbox. More...

#include <QmitkAbstractTrackingDeviceWidget.h>

Inheritance diagram for QmitkAbstractTrackingDeviceWidget:
Collaboration diagram for QmitkAbstractTrackingDeviceWidget:

Signals

void ConnectionTested (bool connected, QString output)
 

Public Member Functions

 QmitkAbstractTrackingDeviceWidget (QWidget *parent=nullptr, Qt::WindowFlags f=nullptr)
 
 ~QmitkAbstractTrackingDeviceWidget () override
 
QmitkAbstractTrackingDeviceWidgetCloneForQt (QWidget *parent=nullptr) const
 Return pointer to copy of the object. Internally use of QmitkUSAbstractCustomWidget::Clone() with additionaly setting an internal flag that the object was really cloned. More...
 
virtual void Initialize ()=0
 Subclass must implement this method to return a pointer to a copy of the object. Please don't forget to call InitializeSuperclassWidget(), CreateQtPartControl and optionally CreateConnections during this function. More...
 
bool IsInitialized () const
 
virtual void ResetOutput ()
 Optional method to add output to a small screen in the trackingToolbox (see QmitkNDIPolarisWidget) More...
 
virtual void AddOutput (std::string)
 Optional method to add output to a small screen in the trackingToolbox (see QmitkNDIPolarisWidget) More...
 
virtual mitk::TrackingDevice::Pointer GetTrackingDevice ()=0
 
virtual void StoreUISettings ()
 Optional method to store and load settings of your widget (see QmitkNDIPolarisWidget) More...
 
virtual void LoadUISettings ()
 Optional method to store and load settings of your widget (see QmitkNDIPolarisWidget) More...
 
virtual bool IsDeviceInstalled ()
 Optional method to investigate if drivers etc for your device are installed. The default value is "true" as most devices don't need this information. Others however migth crash, and for these you might implement this function (see QmitkMicronTrackerWidget) More...
 
virtual void OnConnected (bool)
 This function is called, when in the TrackingToolboxView "Connect" was clicked and the device is successful connected. Can e.g. be used to activate options of a tracking device only when it is connected. More...
 
virtual void OnDisconnected (bool)
 This function is called, when in the TrackingToolboxView "Disconnect" was clicked and the device is successful disconnected. Can e.g. be used to activate/disactivate options of a tracking device. More...
 
virtual void OnStartTracking (bool)
 This function is called, when in the TrackingToolboxView "Start Tracking" was clicked and the device successfully started tracking. Can e.g. be used to activate options of a tracking device only when tracking is started. More...
 
virtual void OnStopTracking (bool)
 This function is called, when in the TrackingToolboxView "Stop Tracking" was clicked and the device successful stopped tracking. Can e.g. be used to activate/disactivate options when device is not tracking. More...
 
virtual void OnToolStorageChanged ()
 This function is called, when anything in the ToolStorage changed, e.g. AddTool or EditTool. ServiceListener is connected in the QmitkMITKIGTTrackingToolboxView. More...
 

Public Attributes

std::string m_ErrorMessage
 current problem description More...
 

Static Public Attributes

static const std::string VIEW_ID
 

Protected Slots

void TestConnectionFinished (bool connected, QString output)
 
void TestConnection ()
 

Protected Member Functions

PERSISTENCE_GET_SERVICE_METHOD_MACRO void InitializeSuperclassWidget ()
 
virtual QmitkAbstractTrackingDeviceWidgetClone (QWidget *parent=nullptr) const =0
 Subclass must implement this method to return a pointer to a copy of the object. Please don't forget to call Initialize() during this function and copy all of your settings. More...
 

Protected Attributes

QmitkTrackingDeviceConfigurationWidgetConnectionWorkerm_TestConnectionWorker
 
QThread * m_TestConnectionWorkerThread
 

Detailed Description

Abstract class to configure a tracking device. Inherited widgets should be registered in the Microservice (TrackingDeviceCollectionWidget), If done so, they will be included in the QmitkTrackingDeviceConfigurationWidget of the Tracking Toolbox.

Documentation:

  • Each implementation of this class must have a method to get a TrackingDevice
  • Each implementation handles itself, if a new TrackingDevice needs to be constructed. Attention: In former MITK versions, there was no pure virtual GetTrackingDevice function but a pure virtual ConstructTrackingDevice function. You can simply rename these, but you should give it a thought, if each time "Construct" was called, a new device needs to be constructed, or if you can store your TrackingDevice in a member variable and return this. Up to you.
  • Please create the UI elements in a function like CreateQtPartControl (e.g. see QmitkVitrualTrackerWidget).
  • You might want to use own buttons etc., please connect them in a private CreateConnections (e.g. see QmitkVitrualTrackerWidget).
  • Due to initialization of qt during autoloading of the IGT module, you constructor should be as slim as possible and only contain a call of the QmitkAbstractTrackingDeviceWidget constructor and simple variable initialization.
  • For the initialization, you must write an Iniltialize() function, which must include a call of InitializeSuperclassWidget() and should contain calls of your private CreateConnections / CreateQtPartControl (if you implemented these).
  • For integration into the TrackingToolbox, a clone function is needed. Here, a new widget should be created, Initialize() needs to be called, and all settings of your widget should be copied.

You can Load and Store previous settings of your GUI elements (e.g. see QmitkNDIPolarisWidget). Also, you can add an output textbox to your widget to display information about your device status. It's optional, see e.g. QmitkNDIAuroraWidget. Some Devices need the information if drivers are installed on your computer. If this is necessary for your device to avoid crashes, please override IsDeviceInstalled. The default return value is true otherwise.

Definition at line 52 of file QmitkAbstractTrackingDeviceWidget.h.

Constructor & Destructor Documentation

◆ QmitkAbstractTrackingDeviceWidget()

QmitkAbstractTrackingDeviceWidget::QmitkAbstractTrackingDeviceWidget ( QWidget *  parent = nullptr,
Qt::WindowFlags  f = nullptr 
)

Definition at line 17 of file QmitkAbstractTrackingDeviceWidget.cpp.

◆ ~QmitkAbstractTrackingDeviceWidget()

QmitkAbstractTrackingDeviceWidget::~QmitkAbstractTrackingDeviceWidget ( )
override

Member Function Documentation

◆ AddOutput()

virtual void QmitkAbstractTrackingDeviceWidget::AddOutput ( std::string  )
inlinevirtual

◆ Clone()

virtual QmitkAbstractTrackingDeviceWidget* QmitkAbstractTrackingDeviceWidget::Clone ( QWidget *  parent = nullptr) const
protectedpure virtual

Subclass must implement this method to return a pointer to a copy of the object. Please don't forget to call Initialize() during this function and copy all of your settings.

Implemented in QmitkPolhemusTrackerWidget, QmitkNDIPolarisWidget, QmitkNDIAuroraWidget, QmitkMicronTrackerWidget, QmitkNPOptitrackWidget, QmitkVirtualTrackerWidget, and QmitkOpenIGTLinkWidget.

Referenced by CloneForQt().

◆ CloneForQt()

QmitkAbstractTrackingDeviceWidget * QmitkAbstractTrackingDeviceWidget::CloneForQt ( QWidget *  parent = nullptr) const

Return pointer to copy of the object. Internally use of QmitkUSAbstractCustomWidget::Clone() with additionaly setting an internal flag that the object was really cloned.

Definition at line 65 of file QmitkAbstractTrackingDeviceWidget.cpp.

References Clone(), IsInitialized(), and MITK_ERROR.

◆ ConnectionTested

void QmitkAbstractTrackingDeviceWidget::ConnectionTested ( bool  connected,
QString  output 
)
signal

Referenced by TestConnection().

◆ GetTrackingDevice()

virtual mitk::TrackingDevice::Pointer QmitkAbstractTrackingDeviceWidget::GetTrackingDevice ( )
pure virtual

◆ Initialize()

virtual void QmitkAbstractTrackingDeviceWidget::Initialize ( )
pure virtual

Subclass must implement this method to return a pointer to a copy of the object. Please don't forget to call InitializeSuperclassWidget(), CreateQtPartControl and optionally CreateConnections during this function.

Implemented in QmitkPolhemusTrackerWidget, QmitkMicronTrackerWidget, QmitkNDIAbstractDeviceWidget, QmitkNDIAuroraWidget, QmitkNDIPolarisWidget, QmitkNPOptitrackWidget, QmitkOpenIGTLinkWidget, and QmitkVirtualTrackerWidget.

◆ InitializeSuperclassWidget()

◆ IsDeviceInstalled()

virtual bool QmitkAbstractTrackingDeviceWidget::IsDeviceInstalled ( )
inlinevirtual

Optional method to investigate if drivers etc for your device are installed. The default value is "true" as most devices don't need this information. Others however migth crash, and for these you might implement this function (see QmitkMicronTrackerWidget)

Reimplemented in QmitkMicronTrackerWidget, and QmitkNPOptitrackWidget.

Definition at line 132 of file QmitkAbstractTrackingDeviceWidget.h.

Referenced by QmitkTrackingDeviceConfigurationWidget::GetTrackingDevice(), QmitkTrackingDeviceConfigurationWidget::LoadUISettings(), and QmitkTrackingDeviceConfigurationWidget::TrackingDeviceChanged().

◆ IsInitialized()

bool QmitkAbstractTrackingDeviceWidget::IsInitialized ( ) const
inline

Definition at line 76 of file QmitkAbstractTrackingDeviceWidget.h.

References PERSISTENCE_GET_SERVICE_METHOD_MACRO.

Referenced by CloneForQt().

◆ LoadUISettings()

virtual void QmitkAbstractTrackingDeviceWidget::LoadUISettings ( )
inlinevirtual

Optional method to store and load settings of your widget (see QmitkNDIPolarisWidget)

Reimplemented in QmitkNDIPolarisWidget, QmitkMicronTrackerWidget, and QmitkNDIAuroraWidget.

Definition at line 125 of file QmitkAbstractTrackingDeviceWidget.h.

Referenced by QmitkTrackingDeviceConfigurationWidget::LoadUISettings().

◆ OnConnected()

virtual void QmitkAbstractTrackingDeviceWidget::OnConnected ( bool  )
inlinevirtual

This function is called, when in the TrackingToolboxView "Connect" was clicked and the device is successful connected. Can e.g. be used to activate options of a tracking device only when it is connected.

Reimplemented in QmitkPolhemusTrackerWidget.

Definition at line 138 of file QmitkAbstractTrackingDeviceWidget.h.

Referenced by QmitkTrackingDeviceConfigurationWidget::OnConnected().

◆ OnDisconnected()

virtual void QmitkAbstractTrackingDeviceWidget::OnDisconnected ( bool  )
inlinevirtual

This function is called, when in the TrackingToolboxView "Disconnect" was clicked and the device is successful disconnected. Can e.g. be used to activate/disactivate options of a tracking device.

Reimplemented in QmitkPolhemusTrackerWidget.

Definition at line 143 of file QmitkAbstractTrackingDeviceWidget.h.

Referenced by QmitkTrackingDeviceConfigurationWidget::OnDisconnected().

◆ OnStartTracking()

virtual void QmitkAbstractTrackingDeviceWidget::OnStartTracking ( bool  )
inlinevirtual

This function is called, when in the TrackingToolboxView "Start Tracking" was clicked and the device successfully started tracking. Can e.g. be used to activate options of a tracking device only when tracking is started.

Reimplemented in QmitkPolhemusTrackerWidget.

Definition at line 149 of file QmitkAbstractTrackingDeviceWidget.h.

Referenced by QmitkTrackingDeviceConfigurationWidget::OnStartTracking().

◆ OnStopTracking()

virtual void QmitkAbstractTrackingDeviceWidget::OnStopTracking ( bool  )
inlinevirtual

This function is called, when in the TrackingToolboxView "Stop Tracking" was clicked and the device successful stopped tracking. Can e.g. be used to activate/disactivate options when device is not tracking.

Definition at line 154 of file QmitkAbstractTrackingDeviceWidget.h.

Referenced by QmitkTrackingDeviceConfigurationWidget::OnStopTracking().

◆ OnToolStorageChanged()

virtual void QmitkAbstractTrackingDeviceWidget::OnToolStorageChanged ( )
inlinevirtual

This function is called, when anything in the ToolStorage changed, e.g. AddTool or EditTool. ServiceListener is connected in the QmitkMITKIGTTrackingToolboxView.

Reimplemented in QmitkPolhemusTrackerWidget.

Definition at line 159 of file QmitkAbstractTrackingDeviceWidget.h.

Referenced by QmitkTrackingDeviceConfigurationWidget::OnToolStorageChanged().

◆ ResetOutput()

virtual void QmitkAbstractTrackingDeviceWidget::ResetOutput ( )
inlinevirtual

Optional method to add output to a small screen in the trackingToolbox (see QmitkNDIPolarisWidget)

Reimplemented in QmitkNDIPolarisWidget, QmitkMicronTrackerWidget, QmitkNPOptitrackWidget, and QmitkNDIAuroraWidget.

Definition at line 110 of file QmitkAbstractTrackingDeviceWidget.h.

Referenced by QmitkTrackingDeviceConfigurationWidget::ResetOutput().

◆ StoreUISettings()

virtual void QmitkAbstractTrackingDeviceWidget::StoreUISettings ( )
inlinevirtual

Optional method to store and load settings of your widget (see QmitkNDIPolarisWidget)

Reimplemented in QmitkNDIPolarisWidget, QmitkMicronTrackerWidget, and QmitkNDIAuroraWidget.

Definition at line 120 of file QmitkAbstractTrackingDeviceWidget.h.

Referenced by QmitkTrackingDeviceConfigurationWidget::StoreUISettings().

◆ TestConnection

◆ TestConnectionFinished

void QmitkAbstractTrackingDeviceWidget::TestConnectionFinished ( bool  connected,
QString  output 
)
protectedslot

Member Data Documentation

◆ m_ErrorMessage

std::string QmitkAbstractTrackingDeviceWidget::m_ErrorMessage

current problem description

Definition at line 162 of file QmitkAbstractTrackingDeviceWidget.h.

Referenced by InitializeSuperclassWidget().

◆ m_TestConnectionWorker

QmitkTrackingDeviceConfigurationWidgetConnectionWorker* QmitkAbstractTrackingDeviceWidget::m_TestConnectionWorker
protected

◆ m_TestConnectionWorkerThread

QThread* QmitkAbstractTrackingDeviceWidget::m_TestConnectionWorkerThread
protected

◆ VIEW_ID

const std::string QmitkAbstractTrackingDeviceWidget::VIEW_ID
static

Definition at line 57 of file QmitkAbstractTrackingDeviceWidget.h.


The documentation for this class was generated from the following files: