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
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,
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 #include "QmitkOpenIGTLinkWidget.h"
18 
20 
21 const std::string QmitkOpenIGTLinkWidget::VIEW_ID = "org.mitk.views.OpenIGTLinkWidget";
22 
23 QmitkOpenIGTLinkWidget::QmitkOpenIGTLinkWidget(QWidget* parent, Qt::WindowFlags f)
25  , m_Controls(nullptr)
26 {
27 }
28 
30 {
32  CreateQtPartControl(this);
33 }
34 
36 {
37  delete m_Controls;
38 }
39 
40 void QmitkOpenIGTLinkWidget::CreateQtPartControl(QWidget *parent)
41 {
42  if (!m_Controls)
43  {
44  // create GUI widgets
45  m_Controls = new Ui::QmitkOpenIGTLinkWidget;
46  m_Controls->setupUi(parent);
47  }
48 }
49 
51 {
52  // Create the Virtual Tracking Device
54  OIGTLDevice->SetPortNumber(m_Controls->m_OpenIGTLinkPort->text().toInt());
55  OIGTLDevice->SetHostname(m_Controls->m_OpenIGTLinkHostname->text().toStdString());
56  OIGTLDevice->SetUpdateRate(m_Controls->m_UpdateRate->value());
57  return static_cast<mitk::TrackingDevice::Pointer>(OIGTLDevice);
58 }
59 
61 {
62  QmitkOpenIGTLinkWidget* clonedWidget = new QmitkOpenIGTLinkWidget(parent);
63  clonedWidget->Initialize();
64 
65  clonedWidget->m_Controls->m_OpenIGTLinkPort->setText(m_Controls->m_OpenIGTLinkPort->text());
66  clonedWidget->m_Controls->m_OpenIGTLinkHostname->setText(m_Controls->m_OpenIGTLinkHostname->text());
67 
68  return clonedWidget;
69 }
virtual QmitkOpenIGTLinkWidget * Clone(QWidget *parent) const
Subclass must implement this method to return a pointer to a copy of the object. Please don't forget ...
static const std::string VIEW_ID
itk::SmartPointer< Self > Pointer
virtual void Initialize()
Subclass must implement this method to return a pointer to a copy of the object. Please don't forget ...
Implementation of a configuration widget to use an Open IGT Link connection to track any device...
virtual mitk::TrackingDevice::Pointer ConstructTrackingDevice()
PERSISTENCE_GET_SERVICE_METHOD_MACRO void InitializeSuperclassWidget()
Abstract class to configure a tracking device. Inherited widgets should be registered in the Microser...
QmitkOpenIGTLinkWidget(QWidget *parent=0, Qt::WindowFlags f=0)
Ui::QmitkOpenIGTLinkWidget * m_Controls