Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkVirtualTrackerWidget.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 
18 
20 
21 const std::string QmitkVirtualTrackerWidget::VIEW_ID = "org.mitk.views.VirtualTrackerWidget";
22 
23 QmitkVirtualTrackerWidget::QmitkVirtualTrackerWidget(QWidget* parent, Qt::WindowFlags f)
25  , m_Controls(nullptr)
26 {
27 }
28 
30 {
32  CreateQtPartControl(this);
33  CreateConnections();
34 }
35 
37 {
38  delete m_Controls;
39 }
40 
41 void QmitkVirtualTrackerWidget::CreateQtPartControl(QWidget *parent)
42 {
43  if (!m_Controls)
44  {
45  // create GUI widgets
46  m_Controls = new Ui::QmitkVirtualTrackerWidget;
47  m_Controls->setupUi(parent);
48  }
49 }
50 
51 void QmitkVirtualTrackerWidget::CreateConnections()
52 {
53  if (m_Controls)
54  {
55  connect((QObject*)(m_Controls->m_EnableGaussianNoise), SIGNAL(clicked()), this, SLOT(EnableGaussianNoise()));
56  }
57 }
58 
60 {
61  // Create the Virtual Tracking Device
63  if (m_Controls->m_EnableGaussianNoise->isChecked())
64  {
65  returnValue->EnableGaussianNoise();
66  returnValue->SetParamsForGaussianNoise(m_Controls->m_MeanDistributionParam->value(), m_Controls->m_DeviationDistributionParam->value());
67  }
68  return static_cast<mitk::TrackingDevice::Pointer>(returnValue); //static_cast necessary for compiling with Linux
69 }
70 
72 {
73  if (m_Controls->m_EnableGaussianNoise->isChecked())
74  {
75  m_Controls->m_MeanDistributionParam->setEnabled(true);
76  m_Controls->m_DeviationDistributionParam->setEnabled(true);
77  }
78  else
79  {
80  m_Controls->m_MeanDistributionParam->setEnabled(false);
81  m_Controls->m_DeviationDistributionParam->setEnabled(false);
82  }
83 }
84 
86 {
87  QmitkVirtualTrackerWidget* clonedWidget = new QmitkVirtualTrackerWidget(parent);
88  clonedWidget->Initialize();
89 
90  clonedWidget->m_Controls->m_EnableGaussianNoise->setEnabled(m_Controls->m_EnableGaussianNoise->isEnabled());
91  clonedWidget->m_Controls->m_MeanDistributionParam->setValue(m_Controls->m_MeanDistributionParam->value());
92  clonedWidget->m_Controls->m_DeviationDistributionParam->setValue(m_Controls->m_DeviationDistributionParam->value());
93  return clonedWidget;
94 }
QmitkVirtualTrackerWidget(QWidget *parent=0, Qt::WindowFlags f=0)
itk::SmartPointer< Self > Pointer
virtual QmitkVirtualTrackerWidget * Clone(QWidget *parent) const
Subclass must implement this method to return a pointer to a copy of the object. Please don't forget ...
virtual void Initialize()
Subclass must implement this method to return a pointer to a copy of the object. Please don't forget ...
virtual mitk::TrackingDevice::Pointer ConstructTrackingDevice()
static const std::string VIEW_ID
PERSISTENCE_GET_SERVICE_METHOD_MACRO void InitializeSuperclassWidget()
Ui::QmitkVirtualTrackerWidget * m_Controls
Abstract class to configure a tracking device. Inherited widgets should be registered in the Microser...
Implementation of a configuration widget for a Vitrual Tracking Device.