Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
QmitkOpenIGTLinkWidget.cpp
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 #include "QmitkOpenIGTLinkWidget.h"
14 
16 
17 const std::string QmitkOpenIGTLinkWidget::VIEW_ID = "org.mitk.views.OpenIGTLinkWidget";
18 
19 QmitkOpenIGTLinkWidget::QmitkOpenIGTLinkWidget(QWidget* parent, Qt::WindowFlags f)
21  , m_Controls(nullptr)
22 {
23 }
24 
26 {
28  CreateQtPartControl(this);
29 }
30 
32 {
33  delete m_Controls;
34 }
35 
36 void 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 
46 mitk::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 }
static const std::string VIEW_ID
QmitkOpenIGTLinkWidget * Clone(QWidget *parent) const override
Subclass must implement this method to return a pointer to a copy of the object. Please don&#39;t forget ...
mitk::TrackingDevice::Pointer GetTrackingDevice() override
Implementation of a configuration widget to use an Open IGT Link connection to track any device...
void Initialize() override
Subclass must implement this method to return a pointer to a copy of the object. Please don&#39;t forget ...
PERSISTENCE_GET_SERVICE_METHOD_MACRO void InitializeSuperclassWidget()
QmitkOpenIGTLinkWidget(QWidget *parent=nullptr, Qt::WindowFlags f=nullptr)
Abstract class to configure a tracking device. Inherited widgets should be registered in the Microser...
Ui::QmitkOpenIGTLinkWidget * m_Controls