Medical Imaging Interaction Toolkit  2018.4.99-389bf124
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 (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 
14 
15 //mitk headers
16 #include <usGetModuleContext.h>
17 #include <usServiceReference.h>
18 
19 
20 
22 : QWidget(parent, f)
23 {
24  m_Controls = nullptr;
25  CreateQtPartControl(this);
26 }
27 
28 
30 {
31 
32 }
33 
35 {
36  if ( !m_Controls )
37  {
38  // create GUI widgets
39  m_Controls = new Ui::QmitkIGTLDeviceSourceSelectionWidgetControls;
40  // setup GUI widgets
41  m_Controls->setupUi(parent);
42  }
43 
45 }
46 
48 {
49  if ( m_Controls )
50  {
51  connect( m_Controls->m_ServiceListWidget,
52  SIGNAL(ServiceSelectionChanged(us::ServiceReferenceU)),
54 
55  //initialize service list widget
56  std::string empty = "";
57  m_Controls->m_ServiceListWidget->Initialize<mitk::IGTLDeviceSource>(
59  }
60 }
61 
63  {
64  if (!s) //nothing selected
65  {
66  //reset everything
67  this->m_CurrentIGTLDeviceSource = nullptr;
69  return;
70  }
71 
72  // Get storage
73  us::ModuleContext* context = us::GetModuleContext();
75  context->GetService<mitk::IGTLDeviceSource>(s);
77  }
78 
80  {
81  return this->m_CurrentIGTLDeviceSource;
82  }
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=nullptr, Qt::WindowFlags f=nullptr)
virtual void CreateConnections()
Creation of the connections.
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
mitk::IGTLDeviceSource::Pointer GetSelectedIGTLDeviceSource()