MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
QmitkOpenIGTLinkManager.cpp
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12
13
14// Blueberry
15#include <berryISelectionService.h>
16#include <berryIWorkbenchWindow.h>
17
18//
20
21
22const std::string QmitkOpenIGTLinkManager::VIEW_ID =
23 "org.mitk.views.openigtlinkmanager";
24
26: QmitkAbstractView()
27{
28}
29
31{
32 for(unsigned int i=0; i < m_AllSourcesHandledByThisWidget.size(); i++)
33 m_AllSourcesHandledByThisWidget.at(i)->UnRegisterMicroservice();
34}
35
39
41{
42 // create GUI widgets from the Qt Designer's .ui file
43 m_Controls.setupUi( parent );
44
45 // create GUI widgets from the Qt Designer's .ui file
46// connect( (QObject*)(m_Controls.m_SourceManagerWidget),
47// SIGNAL(NewSourceAdded(mitk::IGTLDeviceSource::Pointer, std::string)),
48// this,
49// SLOT(NewSourceByWidget(mitk::IGTLDeviceSource::Pointer,std::string)) );
50 connect( (QObject*)(m_Controls.m_SourceListWidget),
51 SIGNAL(IGTLDeviceSourceSelected(mitk::IGTLDeviceSource::Pointer)),
52 this,
53 SLOT(SourceSelected(mitk::IGTLDeviceSource::Pointer)) );
54}
55
56
58 mitk::IGTLDeviceSource::Pointer source,std::string /*sourceName*/)
59{
60 source->RegisterAsMicroservice(/*sourceName*/);
61 m_AllSourcesHandledByThisWidget.push_back(source);
62}
63
65 mitk::IGTLDeviceSource::Pointer source)
66{
67 if (source.IsNull()) //no source selected
68 {
69 //reset everything
70 return;
71 }
72
73 m_CurrentIGTLDevice = source->GetIGTLDevice();
74 this->m_Controls.m_SourceManagerWidget->LoadSource(source);
75
76 //check if the current selected source is also a message provider
77 mitk::IGTLMessageProvider::Pointer currentMsgProvider =
78 mitk::IGTLMessageProvider::New();
79 currentMsgProvider = dynamic_cast<mitk::IGTLMessageProvider*>(source.GetPointer());
80 if(currentMsgProvider.IsNull())
81 return;
82 this->m_Controls.m_StreamManagerWidget->LoadSource(currentMsgProvider);
83}
void NewSourceByWidget(mitk::IGTLDeviceSource::Pointer source, std::string)
static const std::string VIEW_ID
std::vector< mitk::IGTLDeviceSource::Pointer > m_AllSourcesHandledByThisWidget
void CreateQtPartControl(QWidget *parent) override
void SourceSelected(mitk::IGTLDeviceSource::Pointer source)
Ui::QmitkOpenIGTLinkManagerControls m_Controls
mitk::IGTLDevice::Pointer m_CurrentIGTLDevice
Provides information/objects from a MITK-Pipeline to other OpenIGTLink devices.