diff --git a/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.cpp b/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.cpp index 738643af9a..9ec8b1e00d 100644 --- a/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.cpp +++ b/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.cpp @@ -1,169 +1,169 @@ /*=================================================================== 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 //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); //disable a few UI components which are not needed at the moment m_Controls->probe_label->setVisible(false); m_Controls->probe_label2->setVisible(false); m_Controls->zoom_label->setVisible(false); m_Controls->m_Probe->setVisible(false); m_Controls->m_Zoom->setVisible(false); } 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()) ); } // Hide & show stuff m_Controls->m_FilePathSelector->setVisible(false); } ///////////// Methods & Slots Handling Direct Interaction ///////////////// void QmitkUSNewVideoDeviceWidget::OnClickedDone(){ m_Active = false; // Assemble Metadata mitk::USImageMetadata::Pointer metadata = mitk::USImageMetadata::New(); metadata->SetDeviceComment(m_Controls->m_Comment->text().toStdString()); metadata->SetDeviceModel(m_Controls->m_Model->text().toStdString()); metadata->SetDeviceManufacturer(m_Controls->m_Manufacturer->text().toStdString()); metadata->SetProbeName(m_Controls->m_Probe->text().toStdString()); metadata->SetZoom(m_Controls->m_Zoom->text().toStdString()); // Create Device mitk::USVideoDevice::Pointer newDevice; if (m_Controls->m_RadioDeviceSource->isChecked()){ int deviceID = m_Controls->m_DeviceSelector->value(); newDevice = mitk::USVideoDevice::New(deviceID, metadata); } else { std::string filepath = m_Controls->m_FilePathSelector->text().toStdString(); newDevice = mitk::USVideoDevice::New(filepath, metadata); } // Set Video Options newDevice->GetSource()->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(); newDevice->GetSource()->OverrideResolution(width, height); newDevice->GetSource()->SetResolutionOverride(true); } newDevice->Connect(); emit Finished(); } void QmitkUSNewVideoDeviceWidget::OnClickedCancel(){ m_TargetDevice = 0; m_Active = false; emit Finished(); } void QmitkUSNewVideoDeviceWidget::OnDeviceTypeSelection(){ m_Controls->m_FilePathSelector->setVisible(m_Controls->m_RadioFileSource->isChecked()); m_Controls->m_DeviceSelector->setVisible(m_Controls->m_RadioDeviceSource->isChecked()); } ///////////////// 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. Devicetype was: " << device->GetDeviceClass(); + 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; InitFields(mitk::USImageMetadata::New()); 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::InitFields(mitk::USImageMetadata::Pointer metadata){ this->m_Controls->m_Manufacturer->setText (metadata->GetDeviceManufacturer().c_str()); this->m_Controls->m_Model->setText (metadata->GetDeviceModel().c_str()); this->m_Controls->m_Comment->setText (metadata->GetDeviceComment().c_str()); this->m_Controls->m_Probe->setText (metadata->GetProbeName().c_str()); this->m_Controls->m_Zoom->setText (metadata->GetZoom().c_str()); } diff --git a/Modules/USUI/Qmitk/mitkUSDevicePersistence.cpp b/Modules/USUI/Qmitk/mitkUSDevicePersistence.cpp index fae0a09fe9..b038c4e2c9 100644 --- a/Modules/USUI/Qmitk/mitkUSDevicePersistence.cpp +++ b/Modules/USUI/Qmitk/mitkUSDevicePersistence.cpp @@ -1,186 +1,198 @@ /*=================================================================== 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 "usServiceReference.h" -#include "usModuleContext.h" +#include +#include #include #include +//QT +#include + mitk::USDevicePersistence::USDevicePersistence() : m_devices("MITK US","Device Settings") - { - } +{ +} void mitk::USDevicePersistence::StoreCurrentDevices() - { +{ mitk::ModuleContext* thisContext = mitk::GetModuleContext(); std::list services = thisContext->GetServiceReferences(); MITK_INFO << "Trying to save " << services.size() << " US devices."; int numberOfSavedDevices = 0; for(std::list::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") - { + 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."; - } +} void mitk::USDevicePersistence::RestoreLastDevices() - { +{ int numberOfSavedDevices = m_devices.value("numberOfSavedDevices").toInt(); for(int i=0; iConnect(); + } + catch (...) { - QString currentString = m_devices.value("device"+QString::number(i)).toString(); - mitk::USVideoDevice::Pointer currentDevice = StringToUSVideoDevice(currentString); - currentDevice->Connect(); + 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."; - } +} QString mitk::USDevicePersistence::USVideoDeviceToString(mitk::USVideoDevice::Pointer d) { -QString manufacturer = d->GetDeviceManufacturer().c_str(); -QString model = d->GetDeviceModel().c_str(); -QString comment = d->GetDeviceComment().c_str(); -int source = d->GetDeviceID(); -std::string file = d->GetFilePath(); -if (file == "") file = "none"; -int greyscale = d->GetSource()->GetIsGreyscale(); -int resOverride = d->GetSource()->GetResolutionOverride(); -int resWidth = d->GetSource()->GetResolutionOverrideWidth(); -int resHight = d->GetSource()->GetResolutionOverrideHeight(); -int cropRight = d->GetCropArea().cropRight; -int cropLeft = d->GetCropArea().cropLeft; -int cropBottom = d->GetCropArea().cropBottom; -int cropTop = d->GetCropArea().cropTop; -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(cropRight) + seperator - + QString::number(cropLeft) + seperator - + QString::number(cropBottom) + seperator - + QString::number(cropTop) - ; - -MITK_INFO << "Output String: " << returnValue.toStdString(); -return returnValue; + QString manufacturer = d->GetDeviceManufacturer().c_str(); + QString model = d->GetDeviceModel().c_str(); + QString comment = d->GetDeviceComment().c_str(); + int source = d->GetDeviceID(); + std::string file = d->GetFilePath(); + if (file == "") file = "none"; + int greyscale = d->GetSource()->GetIsGreyscale(); + int resOverride = d->GetSource()->GetResolutionOverride(); + int resWidth = d->GetSource()->GetResolutionOverrideWidth(); + int resHight = d->GetSource()->GetResolutionOverrideHeight(); + int cropRight = d->GetCropArea().cropRight; + int cropLeft = d->GetCropArea().cropLeft; + int cropBottom = d->GetCropArea().cropBottom; + int cropTop = d->GetCropArea().cropTop; + 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(cropRight) + seperator + + QString::number(cropLeft) + seperator + + QString::number(cropBottom) + seperator + + QString::number(cropTop) + ; + + MITK_INFO << "Output String: " << returnValue.toStdString(); + return returnValue; } 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() != 13) + MITK_INFO << "Input String: " << s.toStdString(); + std::vector data; + std::string seperators = "|"; + std::string text = s.toStdString(); + split(text,seperators,data); + if(data.size() != 13) { - MITK_ERROR << "Cannot parse US device! (Size: " << data.size() << ")"; - return mitk::USVideoDevice::New("INVALID","INVALID","INVALID"); + 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::USDevice::USImageCropArea cropArea; -cropArea.cropRight = (QString(data.at(9).c_str())).toInt(); -cropArea.cropLeft = (QString(data.at(10).c_str())).toInt(); -cropArea.cropBottom = (QString(data.at(11).c_str())).toInt(); -cropArea.cropTop = (QString(data.at(12).c_str())).toInt(); - -// Assemble Metadata -mitk::USImageMetadata::Pointer metadata = mitk::USImageMetadata::New(); -metadata->SetDeviceManufacturer(manufacturer); -metadata->SetDeviceComment(comment); -metadata->SetDeviceModel(model); -metadata->SetProbeName(""); -metadata->SetZoom(""); - -// Create Device -mitk::USVideoDevice::Pointer returnValue; -if (file == "none") + 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::USDevice::USImageCropArea cropArea; + cropArea.cropRight = (QString(data.at(9).c_str())).toInt(); + cropArea.cropLeft = (QString(data.at(10).c_str())).toInt(); + cropArea.cropBottom = (QString(data.at(11).c_str())).toInt(); + cropArea.cropTop = (QString(data.at(12).c_str())).toInt(); + + // Assemble Metadata + mitk::USImageMetadata::Pointer metadata = mitk::USImageMetadata::New(); + metadata->SetDeviceManufacturer(manufacturer); + metadata->SetDeviceComment(comment); + metadata->SetDeviceModel(model); + metadata->SetProbeName(""); + metadata->SetZoom(""); + + // Create Device + mitk::USVideoDevice::Pointer returnValue; + if (file == "none") { - returnValue = mitk::USVideoDevice::New(source, metadata); + returnValue = mitk::USVideoDevice::New(source, metadata); } -else + else { - returnValue = mitk::USVideoDevice::New(file, metadata); + returnValue = mitk::USVideoDevice::New(file, metadata); } -// Set Video Options -returnValue->GetSource()->SetColorOutput(!greyscale); + // Set Video Options + returnValue->GetSource()->SetColorOutput(!greyscale); -// If Resolution override is activated, apply it -if (resOverride) - { - returnValue->GetSource()->OverrideResolution(resWidth, resHight); - returnValue->GetSource()->SetResolutionOverride(true); - } + // If Resolution override is activated, apply it + if (resOverride) + { + returnValue->GetSource()->OverrideResolution(resWidth, resHight); + returnValue->GetSource()->SetResolutionOverride(true); + } -// Set Crop Area -returnValue->SetCropArea(cropArea); + // Set Crop Area + returnValue->SetCropArea(cropArea); -return returnValue; + return returnValue; } 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); - } + start = text.find_first_not_of(separators, stop + 1); } +} diff --git a/Plugins/org.mitk.gui.qt.ultrasound/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.ultrasound/documentation/UserManual/Manual.dox index 5f9dfdc00d..2b767e9cb6 100644 --- a/Plugins/org.mitk.gui.qt.ultrasound/documentation/UserManual/Manual.dox +++ b/Plugins/org.mitk.gui.qt.ultrasound/documentation/UserManual/Manual.dox @@ -1,19 +1,68 @@ /** -\page org_mitk_gui_qt_ultrasound Ultrasound +\page org_mitk_gui_qt_ultrasound The Ultrasound Plugin \image html icon.xpm "Icon of Ultrasound" Available sections: - \ref org_mitk_gui_qt_ultrasoundOverview \section org_mitk_gui_qt_ultrasoundOverview -Describe the features of your awesome plugin here -
    -
  • Increases productivity -
  • Creates beautiful images -
  • Generates PhD thesis -
  • Brings world peace -
+ +This plugin offers a simple interface to create and manage ultrasound devices. +Devices, once configured, will be stored and loaded on the next start of MITK. +One can configure several aspects of the images acquired. +Last but not least, this plugin makes the configured devices available as a microservice, +exposing them for further usage in other plugins. + +\section org_mitk_gui_qt_ultrasoundPrerequisites Prerequisites + +To make use of this plugin, you obviously require an ultrasound device. +The device must have a video-out of one kind or another. Typical video-outs are: HDMI, DVI, VGA and S-Video. +You also need a Video-Grabber that can acquire the image data from the ultrasound device. +In principal, this plugin is compatible with any grabber that allows the Operating system to access it's functionality. + +However, not all grabbers are created equal. Make sure your grabber supports the video-out offered by your ultrasound device and that it can achieve a satisfying framerate. +We have made good experiences with epiphan Grabbers and currently recommend the epiphan DVI2USB 3.0 device which supports HDMI, DVI and VGA, but less costly grabbers certainly are an option. + +\section org_mitk_gui_qt_ultrasoundCreateDevice Creating an Device + +To configure an ultrasound device, connect the ultrasound device to the grabber and the grabber to the computer. Start the ultrasound device and open the ultrasound plugin. The devicemanager will open. + +\image html devicemanager.png "MITK Screenshot with the devicemanager activated" + +Any currently configured devices are listed in the box, which accordingly is empty now. +Click "New Device". + +\image html newvideodevice.png "The 'New Device' form" + +In the appearing form, enter descriptive data on your device in the corresponding fields. +Manufacturer and model will be used to display the device in MITK. + +You may choose the video source ID if more than one is available (as is the case on laptops with built-in webcams). On Windows, try -1 (defaults to the first available source). On Linux and Mac try 0 and 1. If the wrong camera is address, simply try the next ID. + +Most ultrasound images are grey scale, so using a grey scale conversion doesn't take information away from the image, but makes processing images significantly faster. Only uncheck this box if you require color. + +Click Add Device to save your changes. + +\image html devicemanager_2.png "Devicemanager with configured device" + +\section org_mitk_gui_qt_ultrasoundActivateConnect Activation and Connection + +A ultrasound device in MITK can be connected and activated. The device you just created automatically became connected. A connected device is available to all other plugins in MITK, but does not jet generate image data. Disconnecting the device causes it to be deleted and not be available anymore. + +Click the device, then click "Activate Device". The device is now activated and generates image data continuously. + +Click the "US-Imaging Tab" + +\image html usimaging.png "US Imaging Tab" + +Select the device and click "Start Viewing". The US-Image should appear. +You can adjust the cropping parameters to reduce the acquired image size which will further increase speed and remove unnecessary information. + +All changes are saved and restored whenever MITK is started. + + + */ diff --git a/Plugins/org.mitk.gui.qt.ultrasound/documentation/UserManual/icon.xpm b/Plugins/org.mitk.gui.qt.ultrasound/documentation/UserManual/icon.xpm index 9057c20bc6..54a1bcb8b9 100644 --- a/Plugins/org.mitk.gui.qt.ultrasound/documentation/UserManual/icon.xpm +++ b/Plugins/org.mitk.gui.qt.ultrasound/documentation/UserManual/icon.xpm @@ -1,21 +1,105 @@ /* XPM */ -static const char * icon_xpm[] = { -"16 16 2 1", -" c #FF0000", +static char * C:\Builds\MITK\Plugins\org_mitk_gui_qt_ultrasound\resources\icon_xpm[] = { +"100 100 2 1", +" c None", ". c #000000", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; +" .......................................................................................... ", +" .......................................................................................... ", +" .......................................................................................... ", +" ... .. ", +" ... .. ", +" ... .. ", +" ... .. ", +" ... .. ", +" ... .. .. .. ", +" ... .... ..... .. ", +" ... ................... .. ", +" ... ..................... .. ", +" ... ....................... .. ", +" ... ......................... .. ", +" ... ........................... .. ", +" ... ............................. .. ", +" ... ............................... .. ", +" ... ............ .................. .. ", +" ... ............ ........ .... .. ", +" ... ............. ....... .... .. ", +" ... .............. ...... .... .. ", +" ... ............... ..... .... .. ", +" ... ................ ..... .... .. ", +" ... ................ ..... ..... .. ", +" ... ................. .... ...... .. ", +" ... .................. .... ....... .. ", +" ... ................... .... ........ .. ", +" ... .......... ...... ... .......... .. ", +" ... .. ...... ... ........... .. ", +" ... .. ...... .. ............. .. ", +" ... ... ...... ... ................ .. ", +" ... .... ....... ......................... .. ", +" ... ..... ...... .......................... .. ", +" ... ....... ..... .......................... .. ", +" ... ................. ... .......................... .. ", +" ... .................. .. ........................... .. ", +" ... .................. .......................... .. ", +" ... ................. ......................... .. ", +" ... ................ ......................... .. ", +" ... ............... ........................ .. ", +" ... ............. ......................... .. ", +" ... ............ ........................ .. ", +" ... ........... ......................... .. ", +" ... .......... ........................ .. ", +" ... ........ ......................... .. ", +" ... ....... ....................... .. ", +" ... ....... ....................... .. ", +" ... ...... ....................... .. ", +" ... ........................... .. .. ", +" ... ................... ... .. ", +" ... ..... .. ", +" ... ...... .. ", +" ... ....... .. ", +" ... ....... .. ", +" ... ........ .. ", +" ... ......... .. ", +" ... ......... .. ", +" ... ......... .. ", +" ... ......... .. ", +" ... ......... .. ", +" ... ......... .. ", +" ... ......... .. ", +" ... ......... .. ", +" ... .......... .. ", +" ... ......... .. ", +" ... ......... .. ", +" ... .......... .. ", +" ... .......... ... ", +" .......................................................................................... ", +" .......................................................................................... ", +" ................................. ", +" ................................. ", +" .................................. ", +" ................................. ", +" .................................. ", +" .................................. ", +" ................................. ", +" ................................. ", +" ................................ ", +" ................................ ", +" ................................ ", +" ............................... ", +" .............................. ", +" .............................. ", +" ............................ ", +" ............................ ", +" ........................... ", +" ........................... ", +" .......................... ", +" .......................... ", +" ......................... ", +" ....................... ", +" ..................... ", +" ..................... ", +" .................... ", +" ..................... ", +" ..................... ", +" .................... ", +" ..................... ", +" ..................... "}; diff --git a/Plugins/org.mitk.gui.qt.ultrasound/documentation/doxygen/devicemanagement.png b/Plugins/org.mitk.gui.qt.ultrasound/documentation/doxygen/devicemanagement.png new file mode 100644 index 0000000000..c355ad1e50 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.ultrasound/documentation/doxygen/devicemanagement.png differ diff --git a/Plugins/org.mitk.gui.qt.ultrasound/documentation/doxygen/devicemanagement_2.png b/Plugins/org.mitk.gui.qt.ultrasound/documentation/doxygen/devicemanagement_2.png new file mode 100644 index 0000000000..84ede8a48d Binary files /dev/null and b/Plugins/org.mitk.gui.qt.ultrasound/documentation/doxygen/devicemanagement_2.png differ diff --git a/Plugins/org.mitk.gui.qt.ultrasound/documentation/doxygen/modules.dox b/Plugins/org.mitk.gui.qt.ultrasound/documentation/doxygen/modules.dox index 22a80e24b6..4dae7e103b 100644 --- a/Plugins/org.mitk.gui.qt.ultrasound/documentation/doxygen/modules.dox +++ b/Plugins/org.mitk.gui.qt.ultrasound/documentation/doxygen/modules.dox @@ -1,16 +1,16 @@ /** \defgroup org_mitk_gui_qt_ultrasound org.mitk.gui.qt.ultrasound \ingroup MITKPlugins - \brief Describe your plugin here. + \brief A plugin that manages and views images from ultrasound devices. */ /** \defgroup org_mitk_gui_qt_ultrasound_internal Internal \ingroup org_mitk_gui_qt_ultrasound \brief This subcategory includes the internal classes of the org.mitk.gui.qt.ultrasound plugin. Other plugins must not rely on these classes. They contain implementation details and their interface may change at any time. We mean it. */ diff --git a/Plugins/org.mitk.gui.qt.ultrasound/documentation/doxygen/newvideodevice.png b/Plugins/org.mitk.gui.qt.ultrasound/documentation/doxygen/newvideodevice.png new file mode 100644 index 0000000000..31f4ed2f46 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.ultrasound/documentation/doxygen/newvideodevice.png differ diff --git a/Plugins/org.mitk.gui.qt.ultrasound/documentation/doxygen/usimaging.png b/Plugins/org.mitk.gui.qt.ultrasound/documentation/doxygen/usimaging.png new file mode 100644 index 0000000000..52a2e8f23c Binary files /dev/null and b/Plugins/org.mitk.gui.qt.ultrasound/documentation/doxygen/usimaging.png differ diff --git a/Plugins/org.mitk.gui.qt.ultrasound/src/internal/UltrasoundSupport.cpp b/Plugins/org.mitk.gui.qt.ultrasound/src/internal/UltrasoundSupport.cpp index 4862d50496..48bcc422eb 100644 --- a/Plugins/org.mitk.gui.qt.ultrasound/src/internal/UltrasoundSupport.cpp +++ b/Plugins/org.mitk.gui.qt.ultrasound/src/internal/UltrasoundSupport.cpp @@ -1,211 +1,211 @@ /*=================================================================== 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. ===================================================================*/ // Blueberry #include #include //Mitk #include #include #include // Qmitk #include "UltrasoundSupport.h" #include // Qt #include // Ultrasound #include "mitkUSDevice.h" const std::string UltrasoundSupport::VIEW_ID = "org.mitk.views.ultrasoundsupport"; void UltrasoundSupport::SetFocus() { m_Controls.m_AddDevice->setFocus(); } void UltrasoundSupport::CreateQtPartControl( QWidget *parent ) { m_Timer = new QTimer(this); // create GUI widgets from the Qt Designer's .ui file m_Controls.setupUi( parent ); connect( m_Controls.m_AddDevice, SIGNAL(clicked()), this, SLOT(OnClickedAddNewDevice()) ); // Change Widget Visibilities connect( m_Controls.m_AddDevice, SIGNAL(clicked()), this->m_Controls.m_NewVideoDeviceWidget, SLOT(CreateNewDevice()) ); // Init NewDeviceWidget connect( m_Controls.m_NewVideoDeviceWidget, SIGNAL(Finished()), this, SLOT(OnNewDeviceWidgetDone()) ); // After NewDeviceWidget finished editing connect( m_Controls.m_BtnView, SIGNAL(clicked()), this, SLOT(OnClickedViewDevice()) ); connect( m_Timer, SIGNAL(timeout()), this, SLOT(DisplayImage())); connect( m_Controls.crop_left, SIGNAL(valueChanged(int)), this, SLOT(OnCropAreaChanged()) ); connect( m_Controls.crop_right, SIGNAL(valueChanged(int)), this, SLOT(OnCropAreaChanged()) ); connect( m_Controls.crop_top, SIGNAL(valueChanged(int)), this, SLOT(OnCropAreaChanged()) ); connect( m_Controls.crop_bot, SIGNAL(valueChanged(int)), this, SLOT(OnCropAreaChanged()) ); //connect (m_Controls.m_ActiveVideoDevices, SIGNAL()) // Initializations m_Controls.m_NewVideoDeviceWidget->setVisible(false); std::string filter = "(&(" + mitk::ServiceConstants::OBJECTCLASS() + "=" + "org.mitk.services.UltrasoundDevice)(" + mitk::USDevice::US_PROPKEY_ISACTIVE + "=true))"; m_Controls.m_ActiveVideoDevices->Initialize(mitk::USDevice::US_PROPKEY_LABEL ,filter); //UI initializations m_Controls.crop_left->setEnabled(false); m_Controls.crop_right->setEnabled(false); m_Controls.crop_bot->setEnabled(false); m_Controls.crop_top->setEnabled(false); m_Node = mitk::DataNode::New(); m_Node->SetName("US Image Stream"); this->GetDataStorage()->Add(m_Node); } void UltrasoundSupport::OnClickedAddNewDevice() { m_Controls.m_NewVideoDeviceWidget->setVisible(true); m_Controls.m_DeviceManagerWidget->setVisible(false); m_Controls.m_AddDevice->setVisible(false); m_Controls.m_Headline->setText("Add New Device:"); } void UltrasoundSupport::DisplayImage() { m_Device->UpdateOutputData(0); m_Node->SetData(m_Device->GetOutput()); this->RequestRenderWindowUpdate(); m_FrameCounter ++; if (m_FrameCounter == 10) { int nMilliseconds = m_Clock.restart(); int fps = 10000.0f / (nMilliseconds ); m_Controls.m_FramerateLabel->setText("Current Framerate: "+ QString::number(fps) +" FPS"); m_FrameCounter = 0; } } void UltrasoundSupport::OnCropAreaChanged() { if (m_Device->GetDeviceClass()=="org.mitk.modules.us.USVideoDevice") { mitk::USVideoDevice::Pointer currentVideoDevice = dynamic_cast(m_Device.GetPointer()); mitk::USDevice::USImageCropArea newArea; newArea.cropLeft = m_Controls.crop_left->value(); newArea.cropTop = m_Controls.crop_top->value(); newArea.cropRight = m_Controls.crop_right->value(); newArea.cropBottom = m_Controls.crop_bot->value(); //check enabled: if not we are in the initializing step and don't need to do anything //otherwise: update crop area if (m_Controls.crop_right->isEnabled()) currentVideoDevice->SetCropArea(newArea); GlobalReinit(); } else { MITK_WARN << "No USVideoDevice: Cannot Crop!"; } } void UltrasoundSupport::OnClickedViewDevice() { m_FrameCounter = 0; // We use the activity state of the timer to determine whether we are currently viewing images if ( ! m_Timer->isActive() ) // Activate Imaging { //get device & set data node m_Device = m_Controls.m_ActiveVideoDevices->GetSelectedService(); if (m_Device.IsNull()){ m_Timer->stop(); return; } m_Device->Update(); m_Node->SetData(m_Device->GetOutput()); //start timer int interval = (1000 / m_Controls.m_FrameRate->value()); m_Timer->setInterval(interval); m_Timer->start(); //reinit view GlobalReinit(); //change UI elements m_Controls.m_BtnView->setText("Stop Viewing"); m_Controls.m_FrameRate->setEnabled(false); m_Controls.crop_left->setValue(m_Device->GetCropArea().cropLeft); m_Controls.crop_right->setValue(m_Device->GetCropArea().cropRight); m_Controls.crop_bot->setValue(m_Device->GetCropArea().cropBottom); m_Controls.crop_top->setValue(m_Device->GetCropArea().cropTop); m_Controls.crop_left->setEnabled(true); m_Controls.crop_right->setEnabled(true); m_Controls.crop_bot->setEnabled(true); m_Controls.crop_top->setEnabled(true); } else //deactivate imaging { //stop timer & release data m_Timer->stop(); m_Node->ReleaseData(); this->RequestRenderWindowUpdate(); //change UI elements m_Controls.m_BtnView->setText("Start Viewing"); m_Controls.m_FrameRate->setEnabled(true); m_Controls.crop_left->setEnabled(false); m_Controls.crop_right->setEnabled(false); m_Controls.crop_bot->setEnabled(false); m_Controls.crop_top->setEnabled(false); } } void UltrasoundSupport::OnNewDeviceWidgetDone() { m_Controls.m_NewVideoDeviceWidget->setVisible(false); m_Controls.m_DeviceManagerWidget->setVisible(true); m_Controls.m_AddDevice->setVisible(true); m_Controls.m_Headline->setText("Connected Devices:"); } void UltrasoundSupport::GlobalReinit() { // get all nodes that have not set "includeInBoundingBox" to false mitk::NodePredicateNot::Pointer pred = mitk::NodePredicateNot::New(mitk::NodePredicateProperty::New("includeInBoundingBox", mitk::BoolProperty::New(false))); mitk::DataStorage::SetOfObjects::ConstPointer rs = this->GetDataStorage()->GetSubset(pred); // calculate bounding geometry of these nodes mitk::TimeSlicedGeometry::Pointer bounds = this->GetDataStorage()->ComputeBoundingGeometry3D(rs, "visible"); // initialize the views to the bounding geometry mitk::RenderingManager::GetInstance()->InitializeViews(bounds); } UltrasoundSupport::UltrasoundSupport() { -m_DevicePersistence = mitk::USDevicePersistence::New(); -m_DevicePersistence->RestoreLastDevices(); + m_DevicePersistence = mitk::USDevicePersistence::New(); + m_DevicePersistence->RestoreLastDevices(); } UltrasoundSupport::~UltrasoundSupport() { -m_DevicePersistence->StoreCurrentDevices(); -m_Controls.m_DeviceManagerWidget->DisconnectAllDevices(); + m_DevicePersistence->StoreCurrentDevices(); + m_Controls.m_DeviceManagerWidget->DisconnectAllDevices(); } \ No newline at end of file