Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkIGTLDeviceSourceSelectionWidget.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 
19 //mitk headers
20 #include <usGetModuleContext.h>
21 #include <usServiceReference.h>
22 
23 
24 
26 : QWidget(parent, f)
27 {
28  m_Controls = NULL;
29  CreateQtPartControl(this);
30 }
31 
32 
34 {
35 
36 }
37 
39 {
40  if ( !m_Controls )
41  {
42  // create GUI widgets
43  m_Controls = new Ui::QmitkIGTLDeviceSourceSelectionWidgetControls;
44  // setup GUI widgets
45  m_Controls->setupUi(parent);
46  }
47 
49 }
50 
52 {
53  if ( m_Controls )
54  {
55  connect( m_Controls->m_ServiceListWidget,
56  SIGNAL(ServiceSelectionChanged(us::ServiceReferenceU)),
58 
59  //initialize service list widget
60  std::string empty = "";
61  m_Controls->m_ServiceListWidget->Initialize<mitk::IGTLDeviceSource>(
63  }
64 }
65 
67  {
68  if (!s) //nothing selected
69  {
70  //reset everything
71  this->m_CurrentIGTLDeviceSource = NULL;
73  return;
74  }
75 
76  // Get storage
77  us::ModuleContext* context = us::GetModuleContext();
79  context->GetService<mitk::IGTLDeviceSource>(s);
81  }
82 
84  {
85  return this->m_CurrentIGTLDeviceSource;
86  }
itk::SmartPointer< Self > Pointer
Ui::QmitkIGTLDeviceSourceSelectionWidgetControls * m_Controls
static const std::string US_PROPKEY_IGTLDEVICENAME
These Constants are used in conjunction with Microservices.
Connects a mitk::IGTLDevice to a MITK-OpenIGTLink-Message-Filter-Pipeline.
void IGTLDeviceSourceSelected(mitk::IGTLDeviceSource::Pointer source)
This signal is emitted when a new OpenIGTLink device source is selected.
QmitkIGTLDeviceSourceSelectionWidget(QWidget *parent=0, Qt::WindowFlags f=0)
virtual void CreateConnections()
Creation of the connections.
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
mitk::IGTLDeviceSource::Pointer GetSelectedIGTLDeviceSource()