MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
QmitkUSCombinedModalityCreationWidget.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============================================================================*/
13#include "ui_QmitkUSCombinedModalityCreationWidget.h"
14
16
18QWidget(parent),
20{
21 ui->setupUi(this);
22
23 std::string filterExcludeCombinedModalities = "(&(" + us::ServiceConstants::OBJECTCLASS() + "=" + "org.mitk.services.UltrasoundDevice)(!(" + mitk::USDevice::GetPropertyKeys().US_PROPKEY_CLASS + "=" + mitk::USCombinedModality::DeviceClassIdentifier + ")))";
24
25 connect(ui->usDevicesServiceList, SIGNAL(ServiceSelectionChanged(us::ServiceReferenceU)), this, SLOT(OnSelectedUltrasoundOrTrackingDevice()));
26 connect(ui->trackingDevicesServiceList, SIGNAL(ServiceSelectionChanged(us::ServiceReferenceU)), this, SLOT(OnSelectedUltrasoundOrTrackingDevice()));
27
28 ui->usDevicesServiceList->SetAutomaticallySelectFirstEntry(true);
29 ui->trackingDevicesServiceList->SetAutomaticallySelectFirstEntry(true);
30
31 ui->usDevicesServiceList->Initialize<mitk::USDevice>(mitk::USDevice::GetPropertyKeys().US_PROPKEY_LABEL, filterExcludeCombinedModalities);
32 ui->trackingDevicesServiceList->Initialize<mitk::NavigationDataSource>(mitk::NavigationDataSource::US_PROPKEY_DEVICENAME);
33
34 connect(ui->createButton, SIGNAL(clicked()), this, SLOT(OnCreation()));
35 connect(ui->cancelButton, SIGNAL(clicked()), this, SIGNAL(SignalAborted()));
36}
37
42
44{
45 mitk::USDevice::Pointer usDevice = ui->usDevicesServiceList->GetSelectedService<mitk::USDevice>();
46 if (usDevice.IsNull())
47 {
48 MITK_WARN << "No Ultrasound Device selected for creation of Combined Modality.";
49 return;
50 }
51
52 mitk::NavigationDataSource::Pointer trackingDevice = ui->trackingDevicesServiceList->GetSelectedService<mitk::NavigationDataSource>();
53 if (trackingDevice.IsNull())
54 {
55 MITK_WARN << "No Traccking Device selected for creation of Combined Modality.";
56 return;
57 }
58
59 QString vendor = ui->vendorLineEdit->text();
60 QString name = ui->nameLineEdit->text();
61 if (name.isEmpty()) { name = "Ultrasound Tracker Device"; }
62
63 if( ui->activateTrackedUSCheckbox->isChecked() )
64 {
65 m_CombinedModality = mitk::TrackedUltrasound::New(usDevice, trackingDevice, true);
66 MITK_INFO << "Created TrackedUltrasound device";
67 }
68 else
69 {
70 m_CombinedModality = mitk::USCombinedModality::New(usDevice, trackingDevice, false);
71 MITK_INFO << "Created CombinedModality device";
72 }
73
74 m_CombinedModality->GetUltrasoundDevice()->Initialize();
75 m_CombinedModality->RegisterAsMicroservice(); // register as micro service
76
77 emit SignalCreated();
78 //emit SignalCreated(m_CombinedModality);
79}
80
82{
83 // create button is enabled only if an ultrasound
84 // and a tracking device is selected
85 ui->createButton->setEnabled(
86 ui->usDevicesServiceList->GetIsServiceSelected()
87 && ui->trackingDevicesServiceList->GetIsServiceSelected());
88}
Widget that enables the user to create a mitk::USCombinedModality of a mitk::NavigationDataSource and...
void OnSelectedUltrasoundOrTrackingDevice()
Handles the enabled state of the "Create" button.
void SignalAborted()
Emitted when the user clicks the "Cancel" button.
void SignalCreated()
Emitted when the user clicked the "Create" button and the creation is successful.
void OnCreation()
Creates a combined modility of the selected mitk::NavigationDataSource and mitk::USDevice.
static const std::string US_PROPKEY_DEVICENAME
A device holds information about it's model, make and the connected probes. It is the common super cl...
static mitk::USDevice::PropertyKeys GetPropertyKeys()
const std::string US_PROPKEY_CLASS
const std::string US_PROPKEY_LABEL