15#include <usModuleContext.h>
16#include <usGetModuleContext.h>
22"org.mitk.views.QmitkUSDeviceManagerWidget";
41 m_Controls =
new Ui::QmitkUSDeviceManagerWidgetControls;
45 m_Controls->m_ConnectedDevices->SetAutomaticallySelectFirstEntry(
true);
49 std::string empty =
"";
58 connect(
m_Controls->m_BtnActivate, SIGNAL(clicked()),
this,
62 connect(
m_Controls->m_BtnRemove, SIGNAL(clicked()),
this,
64 connect(
m_Controls->m_BtnNewDevice, SIGNAL(clicked()),
this,
67 SIGNAL(ServiceSelectionChanged(us::ServiceReferenceU)),
this,
69 connect(
m_Controls->m_BtnEdit, SIGNAL(clicked()),
this,
78 mitk::USDevice::Pointer device =
85 if (device->GetIsActive())
92 QApplication::setOverrideCursor(Qt::WaitCursor);
97 if (device->GetIsConnected())
101 QApplication::restoreOverrideCursor();
103 if (!device->GetIsActive())
105 QMessageBox::warning(
106 this,
"Activation failed",
107 "Could not activate device. Check logging for details.");
117 m_Controls->m_ConnectedDevices->GetSelectedServiceReference());
122 mitk::USDevice::Pointer device =
129 if (device->GetIsConnected())
131 device->Disconnect();
135 if (!device->Connect())
137 QMessageBox::warning(
138 this,
"Connecting failed",
139 "Could not connect to device. Check logging for details.");
146 mitk::USDevice::Pointer device =
154 if (device->GetDeviceClass() ==
"org.mitk.modules.us.USVideoDevice")
156 if (device->GetIsActive())
158 device->Deactivate();
160 if (device->GetIsConnected())
162 device->Disconnect();
168 else if (device->GetDeviceClass() ==
"IGTL Client")
170 mitk::USIGTLDevice::Pointer ultrasoundIGTLDevice =
dynamic_cast<mitk::USIGTLDevice*
>(device.GetPointer());
171 if (ultrasoundIGTLDevice->GetIsActive())
173 ultrasoundIGTLDevice->Deactivate();
175 if (ultrasoundIGTLDevice->GetIsConnected())
177 ultrasoundIGTLDevice->Disconnect();
190 mitk::USDevice::Pointer device =
196 us::ServiceReferenceU reference)
205 std::string isConnected =
206 reference.GetProperty(
209 std::string isActive =
210 reference.GetProperty(
214 if (isActive.compare(
"false") == 0)
217 m_Controls->m_BtnActivate->setText(
"Activate");
222 m_Controls->m_BtnActivate->setText(
"Deactivate");
225 std::string deviceClass =
228 m_Controls->m_BtnRemove->setEnabled(deviceClass ==
229 "org.mitk.modules.us.USVideoDevice" || deviceClass ==
"IGTL Client");
230 m_Controls->m_BtnEdit->setEnabled(((deviceClass ==
"org.mitk.modules.us.USVideoDevice") && (isActive.compare(
"false") == 0)) ||
231 ((deviceClass ==
"IGTL Client") && (isActive.compare(
"false") == 0)));
238 us::ModuleContext* thisContext = us::GetModuleContext();
239 std::vector<us::ServiceReference<mitk::USDevice> > services =
241 for (std::vector<us::ServiceReference<mitk::USDevice> >::iterator it =
243 it != services.end(); ++it)
248 MITK_INFO <<
"Disconnected ALL US devises!";
A device holds information about it's model, make and the connected probes. It is the common super cl...
bool Disconnect()
Works analogously to mitk::USDevice::Connect(). Don't override this Method, but onDisconnection inste...
static mitk::USDevice::PropertyKeys GetPropertyKeys()
A mitk::USIGTLDevice is a USDevice to receive images over an OpenIGTLink connection....
void UnregisterOnService()
Remove the IGTLDevice from the micro service.
A mitk::USVideoDevice is the common class for video only devices. They capture video input either fro...
void UnregisterOnService()
Remove this device from the micro service. This method is public for mitk::USVideoDevice,...
const std::string US_PROPKEY_LABEL