MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
QmitkOpenIGTLinkWidget.cpp
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12
14
16
17const std::string QmitkOpenIGTLinkWidget::VIEW_ID = "org.mitk.views.OpenIGTLinkWidget";
18
19QmitkOpenIGTLinkWidget::QmitkOpenIGTLinkWidget(QWidget* parent, Qt::WindowFlags f)
21 , m_Controls(nullptr)
22{
23}
24
26{
28 CreateQtPartControl(this);
29}
30
35
36void QmitkOpenIGTLinkWidget::CreateQtPartControl(QWidget *parent)
37{
38 if (!m_Controls)
39 {
40 // create GUI widgets
41 m_Controls = new Ui::QmitkOpenIGTLinkWidget;
42 m_Controls->setupUi(parent);
43 }
44}
45
46mitk::TrackingDevice::Pointer QmitkOpenIGTLinkWidget::GetTrackingDevice()
47{
48 // Create the Virtual Tracking Device
49 mitk::OpenIGTLinkTrackingDevice::Pointer OIGTLDevice = mitk::OpenIGTLinkTrackingDevice::New();
50 OIGTLDevice->SetPortNumber(m_Controls->m_OpenIGTLinkPort->text().toInt());
51 OIGTLDevice->SetHostname(m_Controls->m_OpenIGTLinkHostname->text().toStdString());
52 OIGTLDevice->SetUpdateRate(m_Controls->m_UpdateRate->value());
53 return static_cast<mitk::TrackingDevice::Pointer>(OIGTLDevice);
54}
55
57{
58 QmitkOpenIGTLinkWidget* clonedWidget = new QmitkOpenIGTLinkWidget(parent);
59 clonedWidget->Initialize();
60
61 clonedWidget->m_Controls->m_OpenIGTLinkPort->setText(m_Controls->m_OpenIGTLinkPort->text());
62 clonedWidget->m_Controls->m_OpenIGTLinkHostname->setText(m_Controls->m_OpenIGTLinkHostname->text());
63
64 return clonedWidget;
65}
Abstract class to configure a tracking device. Inherited widgets should be registered in the Microser...
PERSISTENCE_GET_SERVICE_METHOD_MACRO void InitializeSuperclassWidget()
Implementation of a configuration widget to use an Open IGT Link connection to track any device.
QmitkOpenIGTLinkWidget * Clone(QWidget *parent) const override
Subclass must implement this method to return a pointer to a copy of the object. Please don't forget ...
mitk::TrackingDevice::Pointer GetTrackingDevice() override
Ui::QmitkOpenIGTLinkWidget * m_Controls
static const std::string VIEW_ID
void Initialize() override
Subclass must implement this method to return a pointer to a copy of the object. Please don't forget ...
QmitkOpenIGTLinkWidget(QWidget *parent=nullptr, Qt::WindowFlags f={})