diff --git a/Modules/US/USModel/mitkUSDevicePersistence.cpp b/Modules/US/USModel/mitkUSDevicePersistence.cpp index 64e59dca18..ee0b2e46d4 100644 --- a/Modules/US/USModel/mitkUSDevicePersistence.cpp +++ b/Modules/US/USModel/mitkUSDevicePersistence.cpp @@ -1,332 +1,333 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkUSDevicePersistence.h" //Microservices #include #include #include #include #include mitk::USDevicePersistence::USDevicePersistence() : m_devices("MITK US", "Device Settings") { } void mitk::USDevicePersistence::StoreCurrentDevices() { us::ModuleContext* thisContext = us::GetModuleContext(); std::vector > services = thisContext->GetServiceReferences(); MITK_INFO << "Trying to save " << services.size() << " US devices."; int numberOfSavedDevices = 0; for (std::vector >::iterator it = services.begin(); it != services.end(); ++it) { mitk::USDevice::Pointer currentDevice = thisContext->GetService(*it); //check if it is a USVideoDevice if (currentDevice->GetDeviceClass() == "org.mitk.modules.us.USVideoDevice") { mitk::USVideoDevice::Pointer currentVideoDevice = dynamic_cast(currentDevice.GetPointer()); QString identifier = "device" + QString::number(numberOfSavedDevices); m_devices.setValue(identifier, USVideoDeviceToString(currentVideoDevice)); numberOfSavedDevices++; } else { MITK_WARN << "Saving of US devices of the type " << currentDevice->GetDeviceClass() << " is not supported at the moment. Skipping device."; } } m_devices.setValue("numberOfSavedDevices", numberOfSavedDevices); MITK_INFO << "Successfully saved " << numberOfSavedDevices << " US devices."; } std::vector mitk::USDevicePersistence::RestoreLastDevices() { std::vector devices; int numberOfSavedDevices = m_devices.value("numberOfSavedDevices").toInt(); for (int i = 0; i < numberOfSavedDevices; i++) { // Try each device. If an exception occurs: Ignore device and notify user try { QString currentString = m_devices.value("device" + QString::number(i)).toString(); mitk::USDevice::Pointer currentDevice = dynamic_cast(StringToUSVideoDevice(currentString).GetPointer()); //currentDevice->Initialize(); devices.push_back(currentDevice.GetPointer()); } catch (...) { MITK_ERROR << "Error occured while loading a USVideoDevice from persistence. Device assumed corrupt, will be deleted."; //QMessageBox::warning(NULL, "Could not load device" ,"A stored ultrasound device is corrupted and could not be loaded. The device will be deleted."); } } MITK_INFO << "Restoring " << numberOfSavedDevices << " US devices."; return devices; } QString mitk::USDevicePersistence::USVideoDeviceToString(mitk::USVideoDevice::Pointer d) { QString manufacturer = d->GetManufacturer().c_str(); QString model = d->GetName().c_str(); QString comment = d->GetComment().c_str(); int source = d->GetDeviceID(); std::string file = d->GetFilePath(); if (!d->GetIsSourceFile()) file = "none"; //if GetIsSourceFile is true, the device plays back a file mitk::USImageVideoSource::Pointer imageSource = dynamic_cast(d->GetUSImageSource().GetPointer()); if (!imageSource) { MITK_ERROR << "There is no USImageVideoSource at the current device."; mitkThrow() << "There is no USImageVideoSource at the current device."; } int greyscale = imageSource->GetIsGreyscale(); int resOverride = imageSource->GetResolutionOverride(); int resWidth = imageSource->GetResolutionOverrideWidth(); int resHight = imageSource->GetResolutionOverrideHeight(); mitk::USImageVideoSource::USImageRoi roi = imageSource->GetRegionOfInterest(); - QString probes = "ACV$100%1%1%0$120%2%2%0$150%3%3%0!BDW$90%1%1%0$120%2%2%0"; //for testing purpose needs to be an empty string later + QString probes = ""; //ACV$100%1%1%0$120%2%2%0$140%2%2%5!BDW$90%1%1%2$100%1%1%8!CSV$50%1%2%3$60%2%2%5 char probesSeperator = '!'; std::vector allProbesOfDevice = d->GetAllProbes(); if (allProbesOfDevice.size() > 0) { for (std::vector::iterator it = allProbesOfDevice.begin(); it != allProbesOfDevice.end(); it++) { if (it == allProbesOfDevice.begin()) { // if it is the first element there is no need for the probes seperator probes = probes + USProbeToString(*it); } else { probes = probes + probesSeperator + USProbeToString(*it); } } } char seperator = '|'; QString returnValue = manufacturer + seperator + model + seperator + comment + seperator + QString::number(source) + seperator + file.c_str() + seperator + QString::number(greyscale) + seperator + QString::number(resOverride) + seperator + QString::number(resWidth) + seperator + QString::number(resHight) + seperator + QString::number(roi.topLeftX) + seperator + QString::number(roi.topLeftY) + seperator + QString::number(roi.bottomRightX) + seperator + QString::number(roi.bottomRightY) + seperator + probes ; MITK_INFO << "Output String: " << returnValue.toStdString(); return returnValue; } QString mitk::USDevicePersistence::USProbeToString(mitk::USProbe::Pointer p) { QString probe = p->GetName().c_str(); char depthSeperator = '$'; char spacingSeperator = '%'; std::map depthsAndSpacing = p->GetDepthsAndSpacing(); if (depthsAndSpacing.size() > 0) { for (std::map::iterator it = depthsAndSpacing.begin(); it != depthsAndSpacing.end(); it++){ - probe = probe + depthSeperator + it->first + spacingSeperator + it->second[0] + spacingSeperator + it->second[1] + spacingSeperator + it->second[2]; + probe = probe + depthSeperator + QString::number(it->first) + spacingSeperator + QString::number(it->second[0]) + + spacingSeperator + QString::number(it->second[1]) + spacingSeperator + QString::number(it->second[2]); } } return probe; } mitk::USVideoDevice::Pointer mitk::USDevicePersistence::StringToUSVideoDevice(QString s) { MITK_INFO << "Input String: " << s.toStdString(); std::vector data; std::string seperators = "|"; std::string text = s.toStdString(); split(text, seperators, data); if (data.size() != 14) { MITK_ERROR << "Cannot parse US device! (Size: " << data.size() << ")"; return mitk::USVideoDevice::New("INVALID", "INVALID", "INVALID"); } std::string manufacturer = data.at(0); std::string model = data.at(1); std::string comment = data.at(2); int source = (QString(data.at(3).c_str())).toInt(); std::string file = data.at(4); bool greyscale = (QString(data.at(5).c_str())).toInt(); bool resOverride = (QString(data.at(6).c_str())).toInt(); int resWidth = (QString(data.at(7).c_str())).toInt(); int resHight = (QString(data.at(8).c_str())).toInt(); mitk::USImageVideoSource::USImageRoi cropArea; cropArea.topLeftX = (QString(data.at(9).c_str())).toInt(); cropArea.topLeftY = (QString(data.at(10).c_str())).toInt(); cropArea.bottomRightX = (QString(data.at(11).c_str())).toInt(); cropArea.bottomRightY = (QString(data.at(12).c_str())).toInt(); // Create Device mitk::USVideoDevice::Pointer returnValue; if (file == "none") { returnValue = mitk::USVideoDevice::New(source, manufacturer, model); returnValue->SetComment(comment); } else { returnValue = mitk::USVideoDevice::New(file, manufacturer, model); returnValue->SetComment(comment); } mitk::USImageVideoSource::Pointer imageSource = dynamic_cast(returnValue->GetUSImageSource().GetPointer()); if (!imageSource) { MITK_ERROR << "There is no USImageVideoSource at the current device."; mitkThrow() << "There is no USImageVideoSource at the current device."; } // Set Video Options imageSource->SetColorOutput(!greyscale); // If Resolution override is activated, apply it if (resOverride) { imageSource->OverrideResolution(resWidth, resHight); imageSource->SetResolutionOverride(true); } // Set Crop Area imageSource->SetRegionOfInterest(cropArea); std::string probes = data.at(13); std::string probesSeperator = "!"; std::vector probesVector; split(probes, probesSeperator, probesVector); for (std::vector::iterator it = probesVector.begin(); it != probesVector.end(); it++) { mitk::USProbe::Pointer probe = StringToUSProbe(*it); returnValue->AddNewProbe(probe); } return returnValue; } mitk::USProbe::Pointer mitk::USDevicePersistence::StringToUSProbe(std::string s) { mitk::USProbe::Pointer probe = mitk::USProbe::New(); std::string spacingSeperator = "%"; std::string depthSeperator = "$"; std::vector depthsWithSpacings; split(s, depthSeperator, depthsWithSpacings); for (std::vector::iterator it = depthsWithSpacings.begin(); it != depthsWithSpacings.end(); it++) { if (it == depthsWithSpacings.begin()) //first element is the name of the probe { probe->SetName(*it); } else //other elements are the scanning depths of the probe and the spacing { std::vector spacings; split(*it, spacingSeperator, spacings); mitk::Vector3D spacing; double x; double y; double z; int depth; try { x = spacingToDouble(spacings.at(1)); y = spacingToDouble(spacings.at(2)); z = spacingToDouble(spacings.at(3)); } catch (const mitk::Exception& e) { MITK_ERROR << e.GetDescription() << "Spacing of " << probe->GetName() << " at depth " << spacings.at(0) << " will be set to default value 1,1,0."; x = 1; y = 1; z = 1; } spacing[0] = x; spacing[1] = y; spacing[2] = z; try { depth = depthToInt(spacings.at(0)); } catch (const mitk::Exception& e) { MITK_ERROR << probe->GetName() << ": " << e.GetDescription(); continue; } probe->SetDepthAndSpacing(depth, spacing); } } return probe; } void mitk::USDevicePersistence::split(std::string& text, std::string& separators, std::vector& words) { int n = text.length(); int start, stop; start = text.find_first_not_of(separators); while ((start >= 0) && (start < n)) { stop = text.find_first_of(separators, start); if ((stop < 0) || (stop > n)) stop = n; words.push_back(text.substr(start, stop - start)); start = text.find_first_not_of(separators, stop + 1); } } double mitk::USDevicePersistence::spacingToDouble(std::string s) { std::istringstream i(s); double x; if (!(i >> x)) { //something went wrong because the string contains characters which can not be convertet into double mitkThrow() << "An error occured while trying to recover the spacing."; } return x; } int mitk::USDevicePersistence::depthToInt(std::string s) { std::istringstream i(s); int x; if (!(i >> x)) { //something went wrong because the string contains characters which can not be convertet into int mitkThrow() << "An error occured while trying to recover the scanning depth. " << s << " is not a valid scanning depth. "; } return x; } \ No newline at end of file diff --git a/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.cpp b/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.cpp index 6be14ef6a1..63431d29c6 100644 --- a/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.cpp +++ b/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.cpp @@ -1,225 +1,261 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ //#define _USE_MATH_DEFINES #include // QT headers #include // mitk headers // itk headers const std::string QmitkUSNewVideoDeviceWidget::VIEW_ID = "org.mitk.views.QmitkUSNewVideoDeviceWidget"; QmitkUSNewVideoDeviceWidget::QmitkUSNewVideoDeviceWidget(QWidget* parent, Qt::WindowFlags f) : QWidget(parent, f) { m_Controls = NULL; CreateQtPartControl(this); } QmitkUSNewVideoDeviceWidget::~QmitkUSNewVideoDeviceWidget() {} //////////////////// INITIALIZATION ///////////////////// void QmitkUSNewVideoDeviceWidget::CreateQtPartControl(QWidget* parent) { if (!m_Controls) { // create GUI widgets m_Controls = new Ui::QmitkUSNewVideoDeviceWidgetControls; m_Controls->setupUi(parent); this->CreateConnections(); } } void QmitkUSNewVideoDeviceWidget::CreateConnections() { if (m_Controls) { connect(m_Controls->m_BtnDone, SIGNAL(clicked()), this, SLOT(OnClickedDone())); connect(m_Controls->m_BtnCancel, SIGNAL(clicked()), this, SLOT(OnClickedCancel())); connect(m_Controls->m_RadioDeviceSource, SIGNAL(clicked()), this, SLOT(OnDeviceTypeSelection())); connect(m_Controls->m_RadioFileSource, SIGNAL(clicked()), this, SLOT(OnDeviceTypeSelection())); connect(m_Controls->m_RadioOIGTLClientSource, SIGNAL(clicked()), this, SLOT(OnDeviceTypeSelection())); connect(m_Controls->m_RadioOIGTLServerSource, SIGNAL(clicked()), this, SLOT(OnDeviceTypeSelection())); connect(m_Controls->m_OpenFileButton, SIGNAL(clicked()), this, SLOT(OnOpenFileButtonClicked())); } } ///////////// Methods & Slots Handling Direct Interaction ///////////////// void QmitkUSNewVideoDeviceWidget::OnClickedDone() { m_Active = false; // Create Device mitk::USVideoDevice::Pointer newDevice; if (m_Controls->m_RadioDeviceSource->isChecked()) { newDevice = mitk::USVideoDevice::New( m_Controls->m_DeviceSelector->value(), m_Controls->m_Manufacturer->text().toStdString(), m_Controls->m_Model->text().toStdString()); newDevice->SetComment(m_Controls->m_Comment->text().toStdString()); } else if (m_Controls->m_RadioFileSource->isChecked()) { newDevice = mitk::USVideoDevice::New( m_Controls->m_FilePathSelector->text().toStdString(), m_Controls->m_Manufacturer->text().toStdString(), m_Controls->m_Model->text().toStdString()); newDevice->SetComment(m_Controls->m_Comment->text().toStdString()); } else if (m_Controls->m_RadioOIGTLClientSource->isChecked()) { std::string host = m_Controls->m_OIGTLClientHost->text().toStdString(); int port = m_Controls->m_OIGTLClientPort->value(); // Create a new USIGTLDevice. The last parameter tells the device that it should be a client. mitk::USIGTLDevice::Pointer device = mitk::USIGTLDevice::New(m_Controls->m_Manufacturer->text().toStdString(), m_Controls->m_Model->text().toStdString(), host, port, false); device->Initialize(); emit Finished(); // The rest of this method does stuff that is specific to USVideoDevices, // which we don't need. So we return directly. return; } else { std::string host = m_Controls->m_OIGTLServerHost->text().toStdString(); int port = m_Controls->m_OIGTLServerPort->value(); // Create a new USIGTLDevice. The last parameter tells the device that it should be a server. mitk::USIGTLDevice::Pointer device = mitk::USIGTLDevice::New(m_Controls->m_Manufacturer->text().toStdString(), m_Controls->m_Model->text().toStdString(), host, port, true); device->Initialize(); emit Finished(); // The rest of this method does stuff that is specific to USVideoDevices, // which we don't need. So we return directly. return; } // get USImageVideoSource from new device mitk::USImageVideoSource::Pointer imageSource = dynamic_cast( newDevice->GetUSImageSource().GetPointer()); if (!imageSource) { MITK_ERROR << "There is no USImageVideoSource at the current device."; mitkThrow() << "There is no USImageVideoSource at the current device."; } // Set Video Options imageSource->SetColorOutput(!m_Controls->m_CheckGreyscale->isChecked()); // If Resolution override is activated, apply it if (m_Controls->m_CheckResolutionOverride->isChecked()) { int width = m_Controls->m_ResolutionWidth->value(); int height = m_Controls->m_ResolutionHeight->value(); imageSource->OverrideResolution(width, height); imageSource->SetResolutionOverride(true); } - + if (!m_Controls->m_ProbesInformation->text().isEmpty()) //there are informations for the probes of the device, so create the probes + { + QString probesInformation = m_Controls->m_ProbesInformation->text(); + QStringList probes = probesInformation.split(';'); //split the different probes + for (int i = 0; i < probes.size(); i++) + { + QStringList depths = probes.at(i).split(','); //now for every probe split the probe name and the different depths + mitk::USProbe::Pointer probe = mitk::USProbe::New(); + probe->SetName(depths.at(0).toStdString()); //first element is the probe name + for (int i = 1; i < depths.size(); ++i) //all the other elements are the depths for the specific probe so add them to the probe + { + probe->SetDepth(depths.at(i).toInt()); + } + newDevice->AddNewProbe(probe); + } + } + else //nor informations for the probes of the device, so set default value + { + mitk::USProbe::Pointer probe = mitk::USProbe::New("default"); + probe->SetDepth(0); + newDevice->AddNewProbe(probe); + } newDevice->Initialize(); emit Finished(); } void QmitkUSNewVideoDeviceWidget::OnClickedCancel() { m_TargetDevice = 0; m_Active = false; emit Finished(); } void QmitkUSNewVideoDeviceWidget::OnDeviceTypeSelection() { m_Controls->m_FilePathSelector->setEnabled( m_Controls->m_RadioFileSource->isChecked()); m_Controls->m_DeviceSelector->setEnabled( m_Controls->m_RadioDeviceSource->isChecked()); m_Controls->m_OIGTLClientHost->setEnabled( m_Controls->m_RadioOIGTLClientSource->isChecked()); m_Controls->m_OIGTLClientPort->setEnabled( m_Controls->m_RadioOIGTLClientSource->isChecked()); m_Controls->m_OIGTLServerHost->setEnabled( m_Controls->m_RadioOIGTLServerSource->isChecked()); m_Controls->m_OIGTLServerPort->setEnabled( m_Controls->m_RadioOIGTLServerSource->isChecked()); } void QmitkUSNewVideoDeviceWidget::OnOpenFileButtonClicked() { QString fileName = QFileDialog::getOpenFileName(NULL, "Open Video File"); if (fileName.isNull()) { return; } // user pressed cancel m_Controls->m_FilePathSelector->setText(fileName); m_Controls->m_RadioFileSource->setChecked(true); this->OnDeviceTypeSelection(); } ///////////////// Methods & Slots Handling Logic ////////////////////////// void QmitkUSNewVideoDeviceWidget::EditDevice(mitk::USDevice::Pointer device) { // If no VideoDevice is given, throw an exception if (device->GetDeviceClass().compare("org.mitk.modules.us.USVideoDevice") != 0) { // TODO Alert if bad path mitkThrow() << "NewVideoDeviceWidget recieved an incompatible device type " "to edit. Type was: " << device->GetDeviceClass(); } m_TargetDevice = static_cast(device.GetPointer()); m_Active = true; } void QmitkUSNewVideoDeviceWidget::CreateNewDevice() { m_TargetDevice = 0; m_Active = true; } /////////////////////// HOUSEHOLDING CODE /////////////////////////////// QListWidgetItem* QmitkUSNewVideoDeviceWidget::ConstructItemFromDevice( mitk::USDevice::Pointer device) { QListWidgetItem* result = new QListWidgetItem; std::string text = device->GetDeviceManufacturer() + "|" + device->GetDeviceModel(); result->setText(text.c_str()); return result; } + +void QmitkUSNewVideoDeviceWidget::split(std::string& text, std::string& separators, std::vector& words) +{ + int n = text.length(); + int start, stop; + + start = text.find_first_not_of(separators); + while ((start >= 0) && (start < n)) + { + stop = text.find_first_of(separators, start); + if ((stop < 0) || (stop > n)) stop = n; + words.push_back(text.substr(start, stop - start)); + start = text.find_first_not_of(separators, stop + 1); + } +} diff --git a/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.h b/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.h index 44e10b4385..39c41e54c9 100644 --- a/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.h +++ b/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.h @@ -1,117 +1,114 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef _QmitkUSNewVideoDeviceWidget_H_INCLUDED #define _QmitkUSNewVideoDeviceWidget_H_INCLUDED #include "MitkUSUIExports.h" #include "ui_QmitkUSNewVideoDeviceWidgetControls.h" #include "mitkUSVideoDevice.h" #include "mitkUSIGTLDevice.h" //QT headers #include #include //mitk header /** * @brief This Widget enables the USer to create and connect Video Devices. * * @ingroup USUI */ class MITKUSUI_EXPORT QmitkUSNewVideoDeviceWidget :public QWidget { - //this is needed for all Qt objects that should have a MOC object (everything that derives from QObject) Q_OBJECT - public: +public: - static const std::string VIEW_ID; + static const std::string VIEW_ID; - QmitkUSNewVideoDeviceWidget(QWidget* p = 0, Qt::WindowFlags f1 = 0); - virtual ~QmitkUSNewVideoDeviceWidget(); + QmitkUSNewVideoDeviceWidget(QWidget* p = 0, Qt::WindowFlags f1 = 0); + virtual ~QmitkUSNewVideoDeviceWidget(); - /* @brief This method is part of the widget an needs not to be called seperately. */ - virtual void CreateQtPartControl(QWidget *parent); - /* @brief This method is part of the widget an needs not to be called seperately. (Creation of the connections of main and control widget.)*/ - virtual void CreateConnections(); + /* @brief This method is part of the widget an needs not to be called seperately. */ + virtual void CreateQtPartControl(QWidget *parent); + /* @brief This method is part of the widget an needs not to be called seperately. (Creation of the connections of main and control widget.)*/ + virtual void CreateConnections(); - signals: +signals: - void Finished(); + void Finished(); public slots: - /* - \brief Activates the widget and displays the given device's Data to edit. - */ - void EditDevice(mitk::USDevice::Pointer device); + /* + \brief Activates the widget and displays the given device's Data to edit. + */ + void EditDevice(mitk::USDevice::Pointer device); - /* - \brief Activates the widget with fields empty. - */ - void CreateNewDevice(); + /* + \brief Activates the widget with fields empty. + */ + void CreateNewDevice(); protected slots: - /* - \brief Called, when the the user clicks the "Done" button (Labeled either "Add Device" or "Edit Device", depending on the situation. - */ - void OnClickedDone(); - - /* - \brief Called, when the button "Cancel" was clicked - */ - void OnClickedCancel(); - - /* - \brief Called, when the Use selects one of the Radiobuttons - */ - void OnDeviceTypeSelection(); - - void OnOpenFileButtonClicked(); + /* + \brief Called, when the the user clicks the "Done" button (Labeled either "Add Device" or "Edit Device", depending on the situation. + */ + void OnClickedDone(); + /* + \brief Called, when the button "Cancel" was clicked + */ + void OnClickedCancel(); + /* + \brief Called, when the Use selects one of the Radiobuttons + */ + void OnDeviceTypeSelection(); - protected: + void OnOpenFileButtonClicked(); - Ui::QmitkUSNewVideoDeviceWidgetControls* m_Controls; ///< member holding the UI elements of this widget +protected: - /* - \brief Constructs a ListItem from the given device for display in the list of active devices - */ - QListWidgetItem* ConstructItemFromDevice(mitk::USDevice::Pointer device); + Ui::QmitkUSNewVideoDeviceWidgetControls* m_Controls; ///< member holding the UI elements of this widget - /* - \brief Displays whether this widget is active or not. It gets activated by either sending a Signal to - * the "CreateNewDevice" Slot or to the "EditDevice" Slot. If the user finishes editing the device, a - * "EditingComplete" Signal is sent, and the widget is set to inactive again. Clicking Cancel also - * deactivates it. - */ - bool m_Active; + /* + \brief Constructs a ListItem from the given device for display in the list of active devices + */ + QListWidgetItem* ConstructItemFromDevice(mitk::USDevice::Pointer device); - /** - * \brief This is the device to edit. It is either the device transmitted in the "EditDevice" signal, or a new one - * if the "CreateNewDevice slot was called. - */ - mitk::USVideoDevice::Pointer m_TargetDevice; + /* + \brief Displays whether this widget is active or not. It gets activated by either sending a Signal to + * the "CreateNewDevice" Slot or to the "EditDevice" Slot. If the user finishes editing the device, a + * "EditingComplete" Signal is sent, and the widget is set to inactive again. Clicking Cancel also + * deactivates it. + */ + bool m_Active; + /** + * \brief This is the device to edit. It is either the device transmitted in the "EditDevice" signal, or a new one + * if the "CreateNewDevice slot was called. + */ + mitk::USVideoDevice::Pointer m_TargetDevice; + void split(std::string& text, std::string& separators, std::vector& words); }; #endif // _QmitkUSNewVideoDeviceWidget_H_INCLUDED diff --git a/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidgetControls.ui b/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidgetControls.ui index ca2feae88e..3209a986aa 100644 --- a/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidgetControls.ui +++ b/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidgetControls.ui @@ -1,395 +1,435 @@ - QmitkUSNewVideoDeviceWidgetControls - - - - 0 - 0 - 330 - 595 - - - - - 0 - 0 - - - - QmitkUSNewVideoDeviceWidget - - - - QFormLayout::AllNonFixedFieldsGrow - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Metadata: - - - - - - Comment - - - - - - - - 50 - false - true - - - - Device Information: - - - - - - - Manufacturer - - - - - - - Unknown Manufacturer - - - - - - - Model - - - - - - - Unknown Model - - - - - - - None - - - - - - - - - - Video Source: - - - - - - From Device: - - - true - - - - - - - 0 - - - 10 - - - 0 - - - - - - - From File: - - - - - - - - - false - - - - - - - - - - ... + QmitkUSNewVideoDeviceWidgetControls + + + + 0 + 0 + 330 + 679 + + + + + 0 + 0 + + + + QmitkUSNewVideoDeviceWidget + + + + QFormLayout::AllNonFixedFieldsGrow + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Metadata: - - - + + + + + Comment + + + + + + + + 50 + false + true + + + + Device Information: + + + + + + + Manufacturer + + + + + + + Unknown Manufacturer + + + + + + + Model + + + + + + + Unknown Model + + + + + + + None + + + + + - - - - OIGTL Server - - - - - - - - - false - - - localhost + + + + Video Source: - - - - - - false - - - 1 - - - 65535 - - - 18944 + + + + + From Device: + + + true + + + + + + + 0 + + + 10 + + + 0 + + + + + + + From File: + + + + + + + + + false + + + + + + + + + + ... + + + + + + + + + OIGTL Server + + + + + + + + + false + + + localhost + + + + + + + false + + + 1 + + + 65535 + + + 18944 + + + + + + + + + OIGTL Client + + + + + + + + + false + + + localhost + + + + + + + false + + + 1 + + + 65535 + + + 18944 + + + + + + + + + + + + Video Options: - - - + + + + + Greyscale Image (Significantly faster) + + + true + + + + + - - - - OIGTL Client - - + + + + + + Add Video Device + + + + :/USUI/accept.png:/USUI/accept.png + + + + + + + + Cancel + + + + :/USUI/restart.png:/USUI/restart.png + + + + + - - - - - - false + + + + + 0 + 0 + - - localhost + + + 50 + 130 + - - - - - - false + + Probes - - 1 - - - 65535 - - - 18944 - - - - + + + + 10 + 100 + 301 + 21 + + + + + + + 10 + 20 + 311 + 71 + + + + + Enter the names of the probes of the VideoDevice and, + separated by commas, its scanning depths. + If you want to add several probes separate the probes + and their informations by semicolons. + E.g. ACV,100,120,150;BDW,90,100;CSV,120,150,180 + + + + Qt::PlainText + + + - - - - - - - Video Options: - - - - - - Greyscale Image (Significantly faster) - - - true - - + + + + Override: + + + + + + Width: + + + + + + + + 0 + 0 + + + + 10 + + + 2048 + + + 10 + + + 480 + + + + + + + Height: + + + + + + + Enable Resolution Override + + + + + + + + 0 + 0 + + + + 10 + + + 2048 + + + 10 + + + 640 + + + + + + + If you encounter problems with devices (e.g. Images of uniform color and error messages in the log window), then try to set the resolution externally using the device's driver panel and then enter the same resolution here. + + + true + + + + + - - - - - - - - - Add Video Device - - - - :/USUI/accept.png:/USUI/accept.png - - - - - - - Cancel - - - - :/USUI/restart.png:/USUI/restart.png - - - - - - - - Override: - - - - - - If you encounter problems with devices (e.g. Images of uniform color and error messages in the log window), then try to set the resolution externally using the device's driver panel and then enter the same resolution here. - - - true - - - - - - - Width: - - - - - - - - 0 - 0 - - - - 10 - - - 2048 - - - 10 - - - 640 - - - - - - - - 0 - 0 - - - - 10 - - - 2048 - - - 10 - - - 480 - - - - - - - Height: - - - - - - - Enable Resolution Override - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - m_Manufacturer - m_Model - m_Comment - m_RadioDeviceSource - m_DeviceSelector - m_RadioFileSource - m_CheckResolutionOverride - - - - - + + + + m_Manufacturer + m_Model + m_Comment + m_RadioDeviceSource + m_DeviceSelector + m_RadioFileSource + m_CheckResolutionOverride + + + + +