diff --git a/Modules/US/USModel/mitkUSDevicePersistence.cpp b/Modules/US/USModel/mitkUSDevicePersistence.cpp index c41481dad3..ee0b2e46d4 100644 --- a/Modules/US/USModel/mitkUSDevicePersistence.cpp +++ b/Modules/US/USModel/mitkUSDevicePersistence.cpp @@ -1,207 +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 -mitk::USDevicePersistence::USDevicePersistence() : m_devices("MITK US","Device Settings") +#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) + 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)); + 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); + 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(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 (file == "") file = "none"; + 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 ) + 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$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) - ; + + 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 + 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() != 13) + split(text, seperators, data); + if (data.size() != 14) { MITK_ERROR << "Cannot parse US device! (Size: " << data.size() << ")"; - return mitk::USVideoDevice::New("INVALID","INVALID","INVALID"); + 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 ) + 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/US/USModel/mitkUSDevicePersistence.h b/Modules/US/USModel/mitkUSDevicePersistence.h index 984b808e5b..4211b8c108 100644 --- a/Modules/US/USModel/mitkUSDevicePersistence.h +++ b/Modules/US/USModel/mitkUSDevicePersistence.h @@ -1,66 +1,65 @@ /*=================================================================== 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 MITKUSDevicePersistence_H_HEADER_INCLUDED_ #define MITKUSDevicePersistence_H_HEADER_INCLUDED_ // MITK #include #include +#include // ITK #include // QT #include - namespace mitk { - - /**Documentation - * TODO - */ - - class USDevicePersistence : public itk::Object - { - public: - mitkClassMacroItkParent(USDevicePersistence, itk::Object); - itkFactorylessNewMacro(Self) + /**Documentation + * TODO + */ + + class USDevicePersistence : public itk::Object + { + public: + mitkClassMacroItkParent(USDevicePersistence, itk::Object); + itkFactorylessNewMacro(Self) itkCloneMacro(Self) void StoreCurrentDevices(); - std::vector RestoreLastDevices(); + std::vector RestoreLastDevices(); - protected: + protected: - USDevicePersistence(); - virtual ~USDevicePersistence(){} + USDevicePersistence(); + virtual ~USDevicePersistence(){} - QString USVideoDeviceToString(mitk::USVideoDevice::Pointer d); - mitk::USVideoDevice::Pointer StringToUSVideoDevice(QString s); + QString USVideoDeviceToString(mitk::USVideoDevice::Pointer d); + mitk::USVideoDevice::Pointer StringToUSVideoDevice(QString s); + QString USProbeToString(mitk::USProbe::Pointer p); + mitk::USProbe::Pointer StringToUSProbe(std::string s); - QSettings m_devices; + QSettings m_devices; - void split(std::string& text, std::string& separators, std::vector& words); - - - }; + void split(std::string& text, std::string& separators, std::vector& words); + double spacingToDouble(std::string s); + int depthToInt(std::string s); + }; } // namespace mitk - #endif diff --git a/Modules/US/USModel/mitkUSProbe.cpp b/Modules/US/USModel/mitkUSProbe.cpp index f36b772149..d1d0f7abe5 100644 --- a/Modules/US/USModel/mitkUSProbe.cpp +++ b/Modules/US/USModel/mitkUSProbe.cpp @@ -1,40 +1,88 @@ /*=================================================================== 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 "mitkUSProbe.h" #include - mitk::USProbe::USProbe() : itk::Object() { - } mitk::USProbe::USProbe(std::string identifier) - : m_Name(identifier) + : m_Name(identifier) { } mitk::USProbe::~USProbe() { - } bool mitk::USProbe::IsEqualToProbe(mitk::USProbe::Pointer probe) { - if(m_Name.compare(probe->GetName()) == 0) return true; + if (m_Name.compare(probe->GetName()) == 0) return true; else return false; } + +void mitk::USProbe::SetDepthAndSpacing(int depth, mitk::Vector3D spacing) +{ + m_DepthsAndSpacings.insert(std::pair(depth, spacing)); +} + +std::map mitk::USProbe::GetDepthsAndSpacing() +{ + return m_DepthsAndSpacings; +} + +void mitk::USProbe::SetDepth(int depth) +{ + mitk::Vector3D defaultSpacing; + defaultSpacing[0] = 1; + defaultSpacing[1] = 1; + defaultSpacing[2] = 0; + + m_DepthsAndSpacings.insert(std::pair(depth, defaultSpacing)); +} + +void mitk::USProbe::RemoveDepth(int depthToRemove) +{ + m_DepthsAndSpacings.erase(depthToRemove); +} + +void mitk::USProbe::SetSpacingForGivenDepth(int givenDepth, Vector3D spacing) +{ + m_DepthsAndSpacings[givenDepth][0] = spacing[0]; + m_DepthsAndSpacings[givenDepth][1] = spacing[1]; + m_DepthsAndSpacings[givenDepth][2] = spacing[2]; +} + +mitk::Vector3D mitk::USProbe::GetSpacingForGivenDepth(int givenDepth) +{ + mitk::Vector3D spacing; + std::map::iterator it = m_DepthsAndSpacings.find(givenDepth); + if (it != m_DepthsAndSpacings.end()) //check if given depth really exists + { + spacing[0] = it->second[0]; + spacing[1] = it->second[1]; + spacing[2] = it->second[2]; + } + else + { //spacing does not exist, so set default spacing (1,1,0) + spacing[0] = 1; + spacing[1] = 1; + spacing[2] = 0; + } + return spacing; +} diff --git a/Modules/US/USModel/mitkUSProbe.h b/Modules/US/USModel/mitkUSProbe.h index 27d77baaad..c5b6624b98 100644 --- a/Modules/US/USModel/mitkUSProbe.h +++ b/Modules/US/USModel/mitkUSProbe.h @@ -1,66 +1,96 @@ /*=================================================================== 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 MITKUSProbe_H_HEADER_INCLUDED_ #define MITKUSProbe_H_HEADER_INCLUDED_ #include #include #include #include +#include namespace mitk { - - /**Documentation - * \brief Right now, the US Probe is only a fancy name for a string. Later, it could handle probe specific parameters - * like the current frequency etc. It is able to compare itself to other probes for device managment though. - * - * \ingroup US - */ - //Be sure to check the isEqualTo() method if you expand this class to see if it needs work! + /**Documentation + * \brief Right now, the US Probe is only a fancy name for a string. Later, it could handle probe specific parameters + * like the current frequency etc. It is able to compare itself to other probes for device managment though. + * + * \ingroup US + */ + //Be sure to check the isEqualTo() method if you expand this class to see if it needs work! class MITKUS_EXPORT USProbe : public itk::Object - { - public: - mitkClassMacroItkParent(USProbe,itk::Object); - itkFactorylessNewMacro(Self) + { + public: + mitkClassMacroItkParent(USProbe, itk::Object); + itkFactorylessNewMacro(Self) itkCloneMacro(Self) mitkNewMacro1Param(Self, std::string); - /** - * \brief Compares this probe to another probe and returns true if they are equal in terms of name AND NAME ONLY - * be sure to sufficiently extend this method along with further capabilities probes. - */ - bool IsEqualToProbe(mitk::USProbe::Pointer probe); + /** + * \brief Compares this probe to another probe and returns true if they are equal in terms of name AND NAME ONLY + * be sure to sufficiently extend this method along with further capabilities probes. + */ + bool IsEqualToProbe(mitk::USProbe::Pointer probe); + /** + * \brief Sets a scanning depth of the probe and the associated spacing + */ + void SetDepthAndSpacing(int depth, Vector3D spacing); - //## getter and setter ## + /** + * \brief Gets all scanning depths and the associates spacings of the probe as an std::map with depth as key (represented by an int) and + *spacing as value (represented by a Vector3D) + */ + std::map GetDepthsAndSpacing(); - itkGetMacro(Name, std::string); - itkSetMacro(Name, std::string); + /** + * \brief Sets a scanning depth of the probe with the default spacing (1,1,0). Exact spacing needs to be calibrated. + */ + void SetDepth(int depth); + + /** + * \brief Removes the given depth of the probe, if it exists + */ + void RemoveDepth(int depthToRemove); + + /** + * \ brief Sets the spacing associated to the given depth of the probe. Spacing needs to be calibrated. + */ + void SetSpacingForGivenDepth(int givenDepth, Vector3D spacing); + + /** + * \brief Returns the spacing that is associated to the given depth of the probe. + *If spacing was not calibrated or if depth does not exist for this probe the default spacing (1,1,0) is returned. + */ + Vector3D GetSpacingForGivenDepth(int givenDepth); - protected: - USProbe(); - USProbe(std::string identifier); - virtual ~USProbe(); + //## getter and setter ## - std::string m_Name; + itkGetMacro(Name, std::string); + itkSetMacro(Name, std::string); + protected: + USProbe(); + USProbe(std::string identifier); + virtual ~USProbe(); + std::string m_Name; - }; + // Map containing the depths and the associated spacings as an std::vector with depth as key and spacing as value + std::map m_DepthsAndSpacings; + }; } // namespace mitk #endif diff --git a/Modules/US/USModel/mitkUSVideoDevice.cpp b/Modules/US/USModel/mitkUSVideoDevice.cpp index 0b959888a7..ab9429d22a 100644 --- a/Modules/US/USModel/mitkUSVideoDevice.cpp +++ b/Modules/US/USModel/mitkUSVideoDevice.cpp @@ -1,140 +1,195 @@ /*=================================================================== 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 "mitkUSVideoDevice.h" #include "mitkUSVideoDeviceCustomControls.h" - mitk::USVideoDevice::USVideoDevice(int videoDeviceNumber, std::string manufacturer, std::string model) : mitk::USDevice(manufacturer, model) { Init(); m_SourceIsFile = false; m_DeviceID = videoDeviceNumber; m_FilePath = ""; } mitk::USVideoDevice::USVideoDevice(std::string videoFilePath, std::string manufacturer, std::string model) : mitk::USDevice(manufacturer, model) { Init(); m_SourceIsFile = true; m_FilePath = videoFilePath; } mitk::USVideoDevice::USVideoDevice(int videoDeviceNumber, mitk::USImageMetadata::Pointer metadata) : mitk::USDevice(metadata) { Init(); m_SourceIsFile = false; m_DeviceID = videoDeviceNumber; m_FilePath = ""; } mitk::USVideoDevice::USVideoDevice(std::string videoFilePath, mitk::USImageMetadata::Pointer metadata) : mitk::USDevice(metadata) { Init(); m_SourceIsFile = true; m_FilePath = videoFilePath; } mitk::USVideoDevice::~USVideoDevice() { //m_Source->UnRegister(); m_Source = 0; } void mitk::USVideoDevice::Init() { m_Source = mitk::USImageVideoSource::New(); m_ControlInterfaceCustom = mitk::USVideoDeviceCustomControls::New(this); //this->SetNumberOfInputs(1); this->SetNumberOfIndexedOutputs(1); // mitk::USImage::Pointer output = mitk::USImage::New(); // output->Initialize(); this->SetNthOutput(0, this->MakeOutput(0)); } std::string mitk::USVideoDevice::GetDeviceClass() { return mitk::USVideoDevice::GetDeviceClassStatic(); } std::string mitk::USVideoDevice::GetDeviceClassStatic() { return "org.mitk.modules.us.USVideoDevice"; } mitk::USAbstractControlInterface::Pointer mitk::USVideoDevice::GetControlInterfaceCustom() { return m_ControlInterfaceCustom.GetPointer(); } bool mitk::USVideoDevice::OnInitialization() { // nothing to do at initialization of video device return true; } bool mitk::USVideoDevice::OnConnection() { if (m_SourceIsFile){ m_Source->SetVideoFileInput(m_FilePath); - } else { + } + else { m_Source->SetCameraInput(m_DeviceID); } //SetSourceCropArea(); return true; } bool mitk::USVideoDevice::OnDisconnection() { if (m_DeviceState == State_Activated) this->Deactivate(); m_Source->ReleaseInput(); return true; } bool mitk::USVideoDevice::OnActivation() { // make sure that video device is ready before aquiring images - if ( ! m_Source->GetIsReady() ) + if (!m_Source->GetIsReady()) { MITK_WARN("mitkUSDevice")("mitkUSVideoDevice") << "Could not activate us video device. Check if video grabber is configured correctly."; return false; } MITK_INFO << "Activated UsVideoDevice!"; return true; } bool mitk::USVideoDevice::OnDeactivation() { // happens automatically when m_Active is set to false return true; } void mitk::USVideoDevice::UnregisterOnService() { if (m_DeviceState == State_Activated) { this->Deactivate(); } if (m_DeviceState == State_Connected) { this->Disconnect(); } mitk::USDevice::UnregisterOnService(); } mitk::USImageSource::Pointer mitk::USVideoDevice::GetUSImageSource() { return m_Source.GetPointer(); } + +std::vector mitk::USVideoDevice::GetAllProbes() +{ + if (m_Probes.empty()) + { + MITK_INFO << "No probes exist for this USVideDevice. Empty vector is returned"; + } + return m_Probes; +} + +mitk::USProbe::Pointer mitk::USVideoDevice::GetCurrentProbe() +{ + if (m_CurrentProbe.IsNotNull()) + { + return m_CurrentProbe; + } + else + { + return 0; + } +} + +mitk::USProbe::Pointer mitk::USVideoDevice::GetProbeByName(std::string name) +{ + for (std::vector::iterator it = m_Probes.begin(); it != m_Probes.end(); it++) + { + if (name.compare((*it)->GetName()) == 0) + return (*it); + } + MITK_INFO << "No probe with given name " << name << " was found."; + return 0; //no matching probe was found so 0 is returned +} + +void mitk::USVideoDevice::RemoveProbeByName(std::string name) +{ + for (std::vector::iterator it = m_Probes.begin(); it != m_Probes.end(); it++) + { + if (name.compare((*it)->GetName()) == 0) + { + m_Probes.erase(it); + return; + } + } + MITK_INFO << "No Probe with given name " << name << " was found"; +} + +void mitk::USVideoDevice::AddNewProbe(mitk::USProbe::Pointer probe) +{ + m_Probes.push_back(probe); +} + +bool mitk::USVideoDevice::GetIsSourceFile() +{ + return m_SourceIsFile; +} diff --git a/Modules/US/USModel/mitkUSVideoDevice.h b/Modules/US/USModel/mitkUSVideoDevice.h index 90544c6bd4..840f624b4d 100644 --- a/Modules/US/USModel/mitkUSVideoDevice.h +++ b/Modules/US/USModel/mitkUSVideoDevice.h @@ -1,179 +1,225 @@ /*=================================================================== 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 MITKUSVideoDevice_H_HEADER_INCLUDED_ #define MITKUSVideoDevice_H_HEADER_INCLUDED_ #include #include #include "mitkUSDevice.h" #include "mitkUSImageVideoSource.h" +#include "mitkUSProbe.h" #include namespace itk { template class SmartPointer; } namespace mitk { class USVideoDeviceCustomControls; class USAbstractControlInterface; /** * \brief A mitk::USVideoDevice is the common class for video only devices. * They capture video input either from a file or from a device and * transform the output into an mitk::USImage with attached metadata. * This simple implementation does only capture and display 2d images without * registration for example. * * \ingroup US */ class MITKUS_EXPORT USVideoDevice : public mitk::USDevice { public: mitkClassMacro(USVideoDevice, mitk::USDevice); // To open a device (DeviceID, Manufacturer, Model) mitkNewMacro3Param(Self, int, std::string, std::string); // To open A VideoFile (Path, Manufacturer, Model) mitkNewMacro3Param(Self, std::string, std::string, std::string); // To open a device (DeviceID, Metadata) mitkNewMacro2Param(Self, int, mitk::USImageMetadata::Pointer); // To open A VideoFile (Path, Metadata) mitkNewMacro2Param(Self, std::string, mitk::USImageMetadata::Pointer); /** * \return the qualified name of this class (as returned by GetDeviceClassStatic()) */ virtual std::string GetDeviceClass() override; /** * This methode is necessary instead of a static member attribute to avoid * "static initialization order fiasco" when an instance of this class is * used in a module activator. * * \return the qualified name of this class */ static std::string GetDeviceClassStatic(); /** * Getter for the custom control interface which was created during the * construction process of mitk::USVideoDevice. * * \return custom control interface of the video device */ virtual itk::SmartPointer GetControlInterfaceCustom() override; /** * \brief Remove this device from the micro service. * This method is public for mitk::USVideoDevice, because this devices * can be completly removed. This is not possible for API devices, which * should be available while their sub module is loaded. */ void UnregisterOnService(); /** * \return mitk::USImageSource connected to this device */ virtual USImageSource::Pointer GetUSImageSource() override; + /** + * \brief Return all probes for this USVideoDevice or an empty vector it no probes were set + * Returns a std::vector of all probes that exist for this USVideoDevice if there were probes set while creating or modifying this USVideoDevice. + * Otherwise it returns an empty vector. Therefore always check if vector is filled, before using it! + */ + std::vector GetAllProbes(); + + /** + * \brief Return current active probe for this USVideoDevice + * Returns a pointer to the probe that is currently in use. If there were probes set while creating or modifying this USVideoDevice. + * Returns null otherwise + */ + mitk::USProbe::Pointer GetCurrentProbe(); + + /** + \brief adds a new probe to the device + */ + void AddNewProbe(mitk::USProbe::Pointer probe); + + /** + * \brief get the probe by its name + * Returns a pointer to the probe identified by the given name. If no probe of given name exists for this Device 0 is returned. + */ + mitk::USProbe::Pointer GetProbeByName(std::string name); + + /** + * \brief Removes the Probe with the given name + */ + void RemoveProbeByName(std::string name); + + /** + \brief True, if this Device plays back a file, false if it recieves data from a device + */ + bool GetIsSourceFile(); + itkGetMacro(Image, mitk::Image::Pointer); - itkGetMacro(DeviceID,int); - itkGetMacro(FilePath,std::string); + itkGetMacro(DeviceID, int); + itkGetMacro(FilePath, std::string); protected: /** * \brief Creates a new device that will deliver USImages taken from a video device. * under windows, try -1 for device number, which will grab the first available one * (Open CV functionality) */ USVideoDevice(int videoDeviceNumber, std::string manufacturer, std::string model); /** * \brief Creates a new device that will deliver USImages taken from a video file. */ USVideoDevice(std::string videoFilePath, std::string manufacturer, std::string model); /** * \brief Creates a new device that will deliver USImages taken from a video device. * under windows, try -1 for device number, which will grab the first available one * (Open CV functionality) */ USVideoDevice(int videoDeviceNumber, mitk::USImageMetadata::Pointer metadata); /** * \brief Creates a new device that will deliver USImages taken from a video file. */ USVideoDevice(std::string videoFilePath, mitk::USImageMetadata::Pointer metadata); virtual ~USVideoDevice(); /** * \brief Initializes common properties for all constructors. */ void Init(); /** * \brief Is called during the initialization process. * Returns true if successful and false if unsuccessful. Additionally, you may throw an exception to clarify what went wrong. */ virtual bool OnInitialization() override; /** * \brief Is called during the connection process. * Returns true if successful and false if unsuccessful. Additionally, you may throw an exception to clarify what went wrong. */ virtual bool OnConnection() override; /** * \brief Is called during the disconnection process. * Returns true if successful and false if unsuccessful. Additionally, you may throw an exception to clarify what went wrong. */ virtual bool OnDisconnection() override; /** * \brief Is called during the activation process. After this method is finsihed, the device should be generating images */ virtual bool OnActivation() override; /** * \brief Is called during the deactivation process. After a call to this method the device should still be connected, but not producing images anymore. */ virtual bool OnDeactivation() override; /** * \brief The image source that we use to aquire data */ mitk::USImageVideoSource::Pointer m_Source; /** * \brief True, if this source plays back a file, false if it recieves data from a device */ bool m_SourceIsFile; /** * \brief The device id to connect to. Undefined, if m_SourceIsFile == true; */ int m_DeviceID; /** * \brief The Filepath id to connect to. Undefined, if m_SourceIsFile == false; */ std::string m_FilePath; /** * \brief custom control interface for us video device */ itk::SmartPointer m_ControlInterfaceCustom; + + /** + * \brief probes for this USVideoDevice + */ + std::vector < mitk::USProbe::Pointer > m_Probes; + + /** + \brief probe that is currently in use + */ + mitk::USProbe::Pointer m_CurrentProbe; }; } // namespace mitk #endif // MITKUSVideoDevice_H_HEADER_INCLUDED_ diff --git a/Modules/US/USModel/mitkUSVideoDeviceCustomControls.cpp b/Modules/US/USModel/mitkUSVideoDeviceCustomControls.cpp index 6b5e943ccd..8bba3fdaf7 100644 --- a/Modules/US/USModel/mitkUSVideoDeviceCustomControls.cpp +++ b/Modules/US/USModel/mitkUSVideoDeviceCustomControls.cpp @@ -1,77 +1,96 @@ /*=================================================================== 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 "mitkUSVideoDeviceCustomControls.h" mitk::USVideoDeviceCustomControls::USVideoDeviceCustomControls(itk::SmartPointer device) : mitk::USAbstractControlInterface(device.GetPointer()), m_IsActive(false) { m_ImageSource = dynamic_cast(m_Device->GetUSImageSource().GetPointer()); } mitk::USVideoDeviceCustomControls::~USVideoDeviceCustomControls() { } void mitk::USVideoDeviceCustomControls::SetIsActive(bool isActive) { m_IsActive = isActive; } bool mitk::USVideoDeviceCustomControls::GetIsActive() { return m_IsActive; } void mitk::USVideoDeviceCustomControls::SetCropArea(mitk::USImageVideoSource::USImageCropping newArea) { MITK_INFO << "Set Crop Area L:" << newArea.left << " R:" << newArea.right << " T:" << newArea.top << " B:" << newArea.bottom; if (m_ImageSource.IsNotNull()) { // if area is empty, remove region if ((newArea.bottom == 0) && (newArea.top == 0) && (newArea.left == 0) && (newArea.right == 0)) { m_ImageSource->RemoveRegionOfInterest(); } else { m_ImageSource->SetCropping(newArea); } } else { MITK_WARN << "Cannot set crop are, source is not initialized!"; } } void mitk::USVideoDeviceCustomControls::SetNewDepth(double depth) { m_Device->UpdateServiceProperty(mitk::USDevice::GetPropertyKeys().US_PROPKEY_BMODE_DEPTH, depth); } void mitk::USVideoDeviceCustomControls::SetNewProbeIdentifier(std::string probename) { m_Device->UpdateServiceProperty(mitk::USDevice::GetPropertyKeys().US_PROPKEY_PROBES_SELECTED, probename); } mitk::USImageVideoSource::USImageCropping mitk::USVideoDeviceCustomControls::GetCropArea() { // just return the crop area set at the image source return m_ImageSource->GetCropping(); } + +std::vector mitk::USVideoDeviceCustomControls::GetProbes() +{ + mitk::USVideoDevice::Pointer device = dynamic_cast(m_Device.GetPointer()); + return device->GetAllProbes(); +} + +std::vector mitk::USVideoDeviceCustomControls::GetDepthsForProbe(std::string name) +{ + mitk::USVideoDevice::Pointer device = dynamic_cast(m_Device.GetPointer()); + mitk::USProbe::Pointer probe = device->GetProbeByName(name); + std::map depthsAndSpacings = probe->GetDepthsAndSpacing(); + std::vector depths; + for (std::map::iterator it = depthsAndSpacings.begin(); it != depthsAndSpacings.end(); it++) + { + depths.push_back((it->first)); + } + return depths; +} diff --git a/Modules/US/USModel/mitkUSVideoDeviceCustomControls.h b/Modules/US/USModel/mitkUSVideoDeviceCustomControls.h index f5ee941436..74b725b707 100644 --- a/Modules/US/USModel/mitkUSVideoDeviceCustomControls.h +++ b/Modules/US/USModel/mitkUSVideoDeviceCustomControls.h @@ -1,85 +1,95 @@ /*=================================================================== 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 MITKUSVideoDeviceCustomControls_H_HEADER_INCLUDED_ #define MITKUSVideoDeviceCustomControls_H_HEADER_INCLUDED_ #include "mitkUSAbstractControlInterface.h" #include "mitkUSImageVideoSource.h" #include "mitkUSVideoDevice.h" #include namespace mitk { /** * \brief Custom controls for mitk::USVideoDevice. * Controls image cropping of the corresponding mitk::USImageVideoSource. */ class MITKUS_EXPORT USVideoDeviceCustomControls : public USAbstractControlInterface { public: mitkClassMacro(USVideoDeviceCustomControls, USAbstractControlInterface); mitkNewMacro1Param(Self, itk::SmartPointer); /** * Activate or deactivate the custom controls. This is just for handling * widget visibility in a GUI for example. Cropping will not be deactivated * if this method is called with false. Use * mitk::USVideoDeviceCustomControls::SetCropArea() with an empty are * instead. */ virtual void SetIsActive(bool isActive) override; /** * \return if this custom controls are currently activated */ virtual bool GetIsActive() override; /** * \brief Sets the area that will be cropped from the US image. * Set [0,0,0,0] to disable it, which is also default. */ void SetCropArea(USImageVideoSource::USImageCropping newArea); /** * \return area currently set for image cropping */ mitk::USImageVideoSource::USImageCropping GetCropArea(); /** * \brief Sets new depth value */ void SetNewDepth(double depth); /** * \ brief Sets new probe identifier */ void SetNewProbeIdentifier(std::string probename); + /** + *\brief Get all the probes for the current device + */ + std::vector GetProbes(); + + /** + * \brief Get the scanning dephts of the given probe + */ + std::vector GetDepthsForProbe(std::string name); + protected: /** * Class needs an mitk::USImageVideoSource object for beeing constructed. * This object will be manipulated by the custom controls methods. */ USVideoDeviceCustomControls(itk::SmartPointer device); virtual ~USVideoDeviceCustomControls(); bool m_IsActive; USImageVideoSource::Pointer m_ImageSource; }; } // namespace mitk #endif // MITKUSVideoDeviceCustomControls_H_HEADER_INCLUDED_ \ No newline at end of file diff --git a/Modules/USUI/Qmitk/QmitkUSControlsCustomVideoDeviceWidget.cpp b/Modules/USUI/Qmitk/QmitkUSControlsCustomVideoDeviceWidget.cpp index 83b5dbac9e..fce4b046d2 100644 --- a/Modules/USUI/Qmitk/QmitkUSControlsCustomVideoDeviceWidget.cpp +++ b/Modules/USUI/Qmitk/QmitkUSControlsCustomVideoDeviceWidget.cpp @@ -1,138 +1,156 @@ /*=================================================================== 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 "QmitkUSControlsCustomVideoDeviceWidget.h" #include "ui_QmitkUSControlsCustomVideoDeviceWidget.h" #include #include QmitkUSControlsCustomVideoDeviceWidget::QmitkUSControlsCustomVideoDeviceWidget(QWidget *parent) : QmitkUSAbstractCustomWidget(parent), ui(new Ui::QmitkUSControlsCustomVideoDeviceWidget) { m_Cropping.left = 0; m_Cropping.top = 0; m_Cropping.right = 0; m_Cropping.bottom = 0; } QmitkUSControlsCustomVideoDeviceWidget::~QmitkUSControlsCustomVideoDeviceWidget() { delete ui; } std::string QmitkUSControlsCustomVideoDeviceWidget::GetDeviceClass() const { return mitk::USVideoDevice::GetDeviceClassStatic(); } QmitkUSAbstractCustomWidget* QmitkUSControlsCustomVideoDeviceWidget::Clone(QWidget* parent) const { QmitkUSAbstractCustomWidget* clonedWidget = new QmitkUSControlsCustomVideoDeviceWidget(parent); clonedWidget->SetDevice(this->GetDevice()); return clonedWidget; } void QmitkUSControlsCustomVideoDeviceWidget::OnDeviceSet() { m_ControlInterface = dynamic_cast (this->GetDevice()->GetControlInterfaceCustom().GetPointer()); if (m_ControlInterface.IsNotNull()) { mitk::USImageVideoSource::USImageCropping cropping = m_ControlInterface->GetCropArea(); ui->crop_left->setValue(cropping.left); ui->crop_right->setValue(cropping.right); ui->crop_bot->setValue(cropping.bottom); ui->crop_top->setValue(cropping.top); + + //get all probes and put their names into a combobox + std::vector probes = m_ControlInterface->GetProbes(); + for (std::vector::iterator it = probes.begin(); it != probes.end(); it++) + { + std::string probeName = (*it)->GetName(); + ui->m_ProbeIdentifier->addItem(QString::fromUtf8(probeName.data(), probeName.size())); + } } else { MITK_WARN("QmitkUSAbstractCustomWidget")("QmitkUSControlsCustomVideoDeviceWidget") << "Did not get a custom video device control interface."; } ui->crop_left->setEnabled(m_ControlInterface.IsNotNull()); ui->crop_right->setEnabled(m_ControlInterface.IsNotNull()); ui->crop_bot->setEnabled(m_ControlInterface.IsNotNull()); ui->crop_top->setEnabled(m_ControlInterface.IsNotNull()); } void QmitkUSControlsCustomVideoDeviceWidget::Initialize() { ui->setupUi(this); connect(ui->crop_left, SIGNAL(valueChanged(int)), this, SLOT(OnCropAreaChanged())); connect(ui->crop_right, SIGNAL(valueChanged(int)), this, SLOT(OnCropAreaChanged())); connect(ui->crop_top, SIGNAL(valueChanged(int)), this, SLOT(OnCropAreaChanged())); connect(ui->crop_bot, SIGNAL(valueChanged(int)), this, SLOT(OnCropAreaChanged())); - connect(ui->m_UsDepth, SIGNAL(valueChanged(int)), this, SLOT(OnDepthChanged())); - connect(ui->m_ProbeIdentifier, SIGNAL(textChanged(const QString &)), this, SLOT(OnProbeChanged())); + connect(ui->m_UsDepth, SIGNAL(currentTextChanged(const QString &)), this, SLOT(OnDepthChanged())); + connect(ui->m_ProbeIdentifier, SIGNAL(currentTextChanged(const QString &)), this, SLOT(OnProbeChanged())); } void QmitkUSControlsCustomVideoDeviceWidget::OnCropAreaChanged() { if (m_ControlInterface.IsNull()) { return; } mitk::USImageVideoSource::USImageCropping cropping; cropping.left = ui->crop_left->value(); cropping.top = ui->crop_top->value(); cropping.right = ui->crop_right->value(); cropping.bottom = ui->crop_bot->value(); try { m_ControlInterface->SetCropArea(cropping); m_Cropping = cropping; } catch (mitk::Exception e) { m_ControlInterface->SetCropArea(m_Cropping); // reset to last valid crop //reset values BlockSignalAndSetValue(ui->crop_left, m_Cropping.left); BlockSignalAndSetValue(ui->crop_right, m_Cropping.right); BlockSignalAndSetValue(ui->crop_top, m_Cropping.top); BlockSignalAndSetValue(ui->crop_bot, m_Cropping.bottom); // inform user QMessageBox msgBox; msgBox.setInformativeText("The crop area you specified is invalid.\nPlease make sure that no more pixels are cropped than are available."); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.exec(); MITK_WARN << "User tried to crop beyond limits of the image"; } } void QmitkUSControlsCustomVideoDeviceWidget::OnDepthChanged() { - double depth = ui->m_UsDepth->value(); + double depth = ui->m_UsDepth->currentText().toDouble(); m_ControlInterface->SetNewDepth(depth); } void QmitkUSControlsCustomVideoDeviceWidget::OnProbeChanged() { - QString qtProbename = ui->m_ProbeIdentifier->text(); - std::string probename = qtProbename.toStdString(); + std::string probename = ui->m_ProbeIdentifier->currentText().toStdString(); m_ControlInterface->SetNewProbeIdentifier(probename); + SetDepthsForProbe(probename); } void QmitkUSControlsCustomVideoDeviceWidget::BlockSignalAndSetValue(QSpinBox* target, int value) { bool oldState = target->blockSignals(true); target->setValue(value); target->blockSignals(oldState); } + +void QmitkUSControlsCustomVideoDeviceWidget::SetDepthsForProbe(std::string probename) +{ + ui->m_UsDepth->clear(); + std::vector depths = m_ControlInterface->GetDepthsForProbe(probename); + for (std::vector::iterator it = depths.begin(); it != depths.end(); it++) + { + ui->m_UsDepth->addItem(QString::number(*it)); + } +} diff --git a/Modules/USUI/Qmitk/QmitkUSControlsCustomVideoDeviceWidget.h b/Modules/USUI/Qmitk/QmitkUSControlsCustomVideoDeviceWidget.h index 37da824764..fb7761380c 100644 --- a/Modules/USUI/Qmitk/QmitkUSControlsCustomVideoDeviceWidget.h +++ b/Modules/USUI/Qmitk/QmitkUSControlsCustomVideoDeviceWidget.h @@ -1,99 +1,103 @@ /*=================================================================== 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 QmitkUSControlsCustomVideoDeviceWidget_H #define QmitkUSControlsCustomVideoDeviceWidget_H #include "QmitkUSAbstractCustomWidget.h" #include "mitkUSVideoDeviceCustomControls.h" #include "mitkUSVideoDevice.h" #include namespace Ui { class QmitkUSControlsCustomVideoDeviceWidget; } /** \brief Widget for custom controls of mitk::USVideoDevice. * This class handles the itk::USVideoDeviceCustomControls of video device * objects. */ class QmitkUSControlsCustomVideoDeviceWidget : public QmitkUSAbstractCustomWidget { Q_OBJECT private slots: /** * \brief Called when user changes one of the crop area control elements. */ void OnCropAreaChanged(); /** * \brief Called when user changes the scanning depth of the ultrasound */ void OnDepthChanged(); /** * \brief Called when user chagnes the identifier for the probe of the ultrasoud machine */ void OnProbeChanged(); + /** + * \brief Get all depths for the given probe and fill them into a combobox + */ + void SetDepthsForProbe(std::string probename); public: /** * Constructs widget object. All gui control elements will be disabled until * QmitkUSAbstractCustomWidget::SetDevice() was called. */ explicit QmitkUSControlsCustomVideoDeviceWidget(QWidget *parent = 0); ~QmitkUSControlsCustomVideoDeviceWidget(); /** * Getter for the device class of mitk:USVideoDevice. */ virtual std::string GetDeviceClass() const override; /** * Creates new QmitkUSAbstractCustomWidget with the same mitk::USVideoDevice * and the same mitk::USVideoDeviceCustomControls which were set on the * original object. * * This method is just for being calles by the factory. Use * QmitkUSAbstractCustomWidget::CloneForQt() instead, if you want a clone of * an object. */ virtual QmitkUSAbstractCustomWidget* Clone(QWidget* parent = 0) const override; /** * Gets control interface from the device which was currently set. Control * elements are according to current crop area of the device. If custom * control interface is null, the control elements stay disabled. */ virtual void OnDeviceSet() override; virtual void Initialize() override; protected: void BlockSignalAndSetValue(QSpinBox* target, int value); mitk::USImageVideoSource::USImageCropping m_Cropping; private: Ui::QmitkUSControlsCustomVideoDeviceWidget* ui; mitk::USVideoDeviceCustomControls::Pointer m_ControlInterface; }; #endif // QmitkUSControlsCustomVideoDeviceWidget_H \ No newline at end of file diff --git a/Modules/USUI/Qmitk/QmitkUSControlsCustomVideoDeviceWidget.ui b/Modules/USUI/Qmitk/QmitkUSControlsCustomVideoDeviceWidget.ui index 50e6de0030..c2864d1148 100644 --- a/Modules/USUI/Qmitk/QmitkUSControlsCustomVideoDeviceWidget.ui +++ b/Modules/USUI/Qmitk/QmitkUSControlsCustomVideoDeviceWidget.ui @@ -1,293 +1,282 @@ QmitkUSControlsCustomVideoDeviceWidget 0 0 383 238 Form <html><head/><body><p><span style=" font-weight:600;">Crop Ultrasound Image:</span></p></body></html> Top 0 999 5 0 px Qt::Horizontal 40 20 Bottom 999 5 px Qt::Horizontal 40 20 Right 999 5 px Qt::Horizontal 40 20 Left 999 5 px Qt::Vertical 20 40 mm Qt::Horizontal 40 20 - - - - default - - - <html><head/><body><p><span style=" font-weight:600;">Probe Identifier:</span></p></body></html> Qt::Horizontal 40 20 <html><head/><body><p><span style=" font-weight:600;">Ultrasound Depth: </span></p></body></html> Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - 10 - - - 999 - - + + + + diff --git a/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidget.cpp b/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidget.cpp index 8ad8f92ab1..08303d6c71 100644 --- a/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidget.cpp +++ b/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidget.cpp @@ -1,226 +1,236 @@ /*=================================================================== 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 #include #include #include #include "mitkUSVideoDevice.h" const std::string QmitkUSDeviceManagerWidget::VIEW_ID = - "org.mitk.views.QmitkUSDeviceManagerWidget"; +"org.mitk.views.QmitkUSDeviceManagerWidget"; QmitkUSDeviceManagerWidget::QmitkUSDeviceManagerWidget(QWidget* parent, - Qt::WindowFlags f) + Qt::WindowFlags f) : QWidget(parent, f) { m_Controls = NULL; CreateQtPartControl(this); } QmitkUSDeviceManagerWidget::~QmitkUSDeviceManagerWidget() {} //////////////////// INITIALIZATION ///////////////////// void QmitkUSDeviceManagerWidget::CreateQtPartControl(QWidget* parent) { if (!m_Controls) { // create GUI widgets m_Controls = new Ui::QmitkUSDeviceManagerWidgetControls; m_Controls->setupUi(parent); this->CreateConnections(); m_Controls->m_ConnectedDevices->SetAutomaticallySelectFirstEntry(true); } // Initializations std::string empty = ""; m_Controls->m_ConnectedDevices->Initialize( - mitk::USDevice::GetPropertyKeys().US_PROPKEY_LABEL, empty); + mitk::USDevice::GetPropertyKeys().US_PROPKEY_LABEL, empty); } void QmitkUSDeviceManagerWidget::CreateConnections() { if (m_Controls) { connect(m_Controls->m_BtnActivate, SIGNAL(clicked()), this, - SLOT(OnClickedActivateDevice())); + SLOT(OnClickedActivateDevice())); // connect( m_Controls->m_BtnDisconnect, SIGNAL( clicked() ), this, // SLOT(OnClickedDisconnectDevice()) ); connect(m_Controls->m_BtnRemove, SIGNAL(clicked()), this, - SLOT(OnClickedRemoveDevice())); + SLOT(OnClickedRemoveDevice())); connect(m_Controls->m_BtnNewDevice, SIGNAL(clicked()), this, - SLOT(OnClickedNewDevice())); + SLOT(OnClickedNewDevice())); connect(m_Controls->m_ConnectedDevices, - SIGNAL(ServiceSelectionChanged(us::ServiceReferenceU)), this, - SLOT(OnDeviceSelectionChanged(us::ServiceReferenceU))); + SIGNAL(ServiceSelectionChanged(us::ServiceReferenceU)), this, + SLOT(OnDeviceSelectionChanged(us::ServiceReferenceU))); + connect(m_Controls->m_BtnEdit, SIGNAL(clicked()), this, + SLOT(OnClickedEditDevice())); } } ///////////// Methods & Slots Handling Direct Interaction ///////////////// void QmitkUSDeviceManagerWidget::OnClickedActivateDevice() { mitk::USDevice::Pointer device = - m_Controls->m_ConnectedDevices->GetSelectedService(); + m_Controls->m_ConnectedDevices->GetSelectedService(); if (device.IsNull()) { return; } if (device->GetIsActive()) { device->Deactivate(); device->Disconnect(); } else { QApplication::setOverrideCursor(Qt::WaitCursor); if (device->GetDeviceState() < mitk::USDevice::State_Connected) { device->Connect(); } if (device->GetIsConnected()) { device->Activate(); } QApplication::restoreOverrideCursor(); if (!device->GetIsActive()) { QMessageBox::warning( - this, "Activation failed", - "Could not activate device. Check logging for details."); + this, "Activation failed", + "Could not activate device. Check logging for details."); } else { emit DeviceActivated(); } } // Manually reevaluate Button logic OnDeviceSelectionChanged( - m_Controls->m_ConnectedDevices->GetSelectedServiceReference()); + m_Controls->m_ConnectedDevices->GetSelectedServiceReference()); } void QmitkUSDeviceManagerWidget::OnClickedDisconnectDevice() { mitk::USDevice::Pointer device = - m_Controls->m_ConnectedDevices->GetSelectedService(); + m_Controls->m_ConnectedDevices->GetSelectedService(); if (device.IsNull()) { return; } if (device->GetIsConnected()) { device->Disconnect(); } else { if (!device->Connect()) { QMessageBox::warning( - this, "Connecting failed", - "Could not connect to device. Check logging for details."); + this, "Connecting failed", + "Could not connect to device. Check logging for details."); } } } void QmitkUSDeviceManagerWidget::OnClickedRemoveDevice() { mitk::USDevice::Pointer device = - m_Controls->m_ConnectedDevices->GetSelectedService(); + m_Controls->m_ConnectedDevices->GetSelectedService(); if (device.IsNull()) { return; } if (device->GetDeviceClass() == "org.mitk.modules.us.USVideoDevice") { if (device->GetIsActive()) { device->Deactivate(); } if (device->GetIsConnected()) { device->Disconnect(); } dynamic_cast(device.GetPointer()) - ->UnregisterOnService(); + ->UnregisterOnService(); } } void QmitkUSDeviceManagerWidget::OnClickedNewDevice() { emit NewDeviceButtonClicked(); } +void QmitkUSDeviceManagerWidget::OnClickedEditDevice() +{ + mitk::USDevice::Pointer device = + m_Controls->m_ConnectedDevices->GetSelectedService(); + emit EditDeviceButtonClicked(device); +} + void QmitkUSDeviceManagerWidget::OnDeviceSelectionChanged( - us::ServiceReferenceU reference) + us::ServiceReferenceU reference) { if (!reference) { m_Controls->m_BtnActivate->setEnabled(false); m_Controls->m_BtnRemove->setEnabled(false); return; } std::string isConnected = - reference.GetProperty( - mitk::USDevice::GetPropertyKeys().US_PROPKEY_ISCONNECTED) - .ToString(); + reference.GetProperty( + mitk::USDevice::GetPropertyKeys().US_PROPKEY_ISCONNECTED) + .ToString(); std::string isActive = - reference.GetProperty( - mitk::USDevice::GetPropertyKeys().US_PROPKEY_ISACTIVE) - .ToString(); + reference.GetProperty( + mitk::USDevice::GetPropertyKeys().US_PROPKEY_ISACTIVE) + .ToString(); if (isActive.compare("false") == 0) { m_Controls->m_BtnActivate->setEnabled(true); m_Controls->m_BtnActivate->setText("Activate"); } else { m_Controls->m_BtnActivate->setEnabled(true); m_Controls->m_BtnActivate->setText("Deactivate"); } std::string deviceClass = - reference.GetProperty(mitk::USDevice::GetPropertyKeys().US_PROPKEY_CLASS) - .ToString(); + reference.GetProperty(mitk::USDevice::GetPropertyKeys().US_PROPKEY_CLASS) + .ToString(); m_Controls->m_BtnRemove->setEnabled(deviceClass == - "org.mitk.modules.us.USVideoDevice"); + "org.mitk.modules.us.USVideoDevice"); + m_Controls->m_BtnEdit->setEnabled((deviceClass == "org.mitk.modules.us.USVideoDevice") && (isActive.compare("false") == 0)); } void QmitkUSDeviceManagerWidget::DisconnectAllDevices() { // at the moment disconnects ALL devices. Maybe we only want to disconnect the // devices handled by this widget? us::ModuleContext* thisContext = us::GetModuleContext(); std::vector > services = - thisContext->GetServiceReferences(); + thisContext->GetServiceReferences(); for (std::vector >::iterator it = - services.begin(); - it != services.end(); ++it) + services.begin(); + it != services.end(); ++it) { mitk::USDevice* currentDevice = thisContext->GetService(*it); currentDevice->Disconnect(); } MITK_INFO << "Disconnected ALL US devises!"; } diff --git a/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidget.h b/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidget.h index 6aa377d144..ccda656c99 100644 --- a/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidget.h +++ b/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidget.h @@ -1,95 +1,93 @@ /*=================================================================== 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 _QmitkUSDeviceManagerWidget_H_INCLUDED #define _QmitkUSDeviceManagerWidget_H_INCLUDED #include "MitkUSUIExports.h" #include "ui_QmitkUSDeviceManagerWidgetControls.h" #include "mitkUSDevice.h" #include //QT headers #include #include - /** * @brief This Widget is used to manage available Ultrasound Devices. * * It allows activation, deactivation and disconnection of connected devices. * * @ingroup USUI */ class MITKUSUI_EXPORT QmitkUSDeviceManagerWidget :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; - QmitkUSDeviceManagerWidget(QWidget* p = 0, Qt::WindowFlags f1 = 0); - virtual ~QmitkUSDeviceManagerWidget(); + QmitkUSDeviceManagerWidget(QWidget* p = 0, Qt::WindowFlags f1 = 0); + virtual ~QmitkUSDeviceManagerWidget(); - /* @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 Disconnects all devices immediately. */ - virtual void DisconnectAllDevices(); + /* @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 Disconnects all devices immediately. */ + virtual void DisconnectAllDevices(); - signals: - void NewDeviceButtonClicked(); +signals: + void NewDeviceButtonClicked(); + void EditDeviceButtonClicked(mitk::USDevice::Pointer); - /* This signal is emitted if a device is activated. */ - void DeviceActivated(); + /* This signal is emitted if a device is activated. */ + void DeviceActivated(); public slots: - protected slots: + protected slots : /* \brief Called, when the button "Activate Device" was clicked. */ void OnClickedActivateDevice(); - /* - \brief Called, when the button "Disconnect Device" was clicked. - */ - void OnClickedDisconnectDevice(); - - void OnClickedRemoveDevice(); - void OnClickedNewDevice(); - - /* - \brief Called, when the selection in the devicelist changes. - */ - void OnDeviceSelectionChanged(us::ServiceReferenceU reference); + /* + \brief Called, when the button "Disconnect Device" was clicked. + */ + void OnClickedDisconnectDevice(); + void OnClickedRemoveDevice(); + void OnClickedNewDevice(); - protected: + void OnClickedEditDevice(); - Ui::QmitkUSDeviceManagerWidgetControls* m_Controls; ///< member holding the UI elements of this widget + /* + \brief Called, when the selection in the devicelist changes. + */ + void OnDeviceSelectionChanged(us::ServiceReferenceU reference); - private: +protected: + Ui::QmitkUSDeviceManagerWidgetControls* m_Controls; ///< member holding the UI elements of this widget +private: }; #endif // _QmitkUSDeviceManagerWidget_H_INCLUDED diff --git a/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidgetControls.ui b/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidgetControls.ui index 98c90eae94..cd0767938d 100644 --- a/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidgetControls.ui +++ b/Modules/USUI/Qmitk/QmitkUSDeviceManagerWidgetControls.ui @@ -1,80 +1,90 @@ QmitkUSDeviceManagerWidgetControls 0 0 405 - 231 + 234 0 0 QmitkUSDeviceManagerWidget + + + + false + + + Remove + + + + :/USUI/minus.png:/USUI/minus.png + + + New Video Device :/USUI/plus.png:/USUI/plus.png - - + + false - Remove - - - - :/USUI/minus.png:/USUI/minus.png + Edit Video Device - + false Activate QmitkServiceListWidget QWidget
QmitkServiceListWidget.h
1
diff --git a/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.cpp b/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.cpp index 6be14ef6a1..4982e581aa 100644 --- a/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.cpp +++ b/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.cpp @@ -1,225 +1,404 @@ /*=================================================================== 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_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())); + + //Connect buttons and functions for editing of probes + connect(m_Controls->m_BtnRemoveProbe, SIGNAL(clicked()), this, SLOT(OnClickedRemoveProbe())); + connect(m_Controls->m_BtnRemoveDepth, SIGNAL(clicked()), this, SLOT(OnClickedRemoveDepth())); + connect(m_Controls->m_BtnAddDepths, SIGNAL(clicked()), this, SLOT(OnClickedAddDepths())); + connect(m_Controls->m_Probes, SIGNAL(currentTextChanged(const QString &)), this, SLOT(OnProbeChanged(const QString &))); } } ///////////// 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 about the probes of the device, so create the probes + { + AddProbesToDevice(newDevice); + } + else //no information about 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(); + CleanUpAfterCreatingNewDevice(); + + emit Finished(); +} + +void QmitkUSNewVideoDeviceWidget::OnClickedFinishedEditing() +{ + m_Active = false; + m_TargetDevice->SetManufacturer(m_Controls->m_Manufacturer->text().toStdString()); + m_TargetDevice->SetName(m_Controls->m_Model->text().toStdString()); + m_TargetDevice->SetComment(m_Controls->m_Comment->text().toStdString()); + + if (!m_Controls->m_ProbesInformation->text().isEmpty()){ //there is information about probes to add, so add them + AddProbesToDevice(m_TargetDevice); + } + mitk::USImageVideoSource::Pointer imageSource = + dynamic_cast( + m_TargetDevice->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); + } + CleanUpAfterEditingOfDevice(); + MITK_INFO << "Finished Editing"; emit Finished(); } void QmitkUSNewVideoDeviceWidget::OnClickedCancel() { m_TargetDevice = 0; m_Active = false; + CleanUpAfterCreatingNewDevice(); + CleanUpAfterEditingOfDevice(); 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; + + ChangeUIEditingUSVideoDevice(); } void QmitkUSNewVideoDeviceWidget::CreateNewDevice() { + //When new device is created there are no probes to edit, therefore disable the Groupbox + m_Controls->m_GroupBoxEditProbes->setEnabled(false); + + //Toggle functionality of Btn_Done + connect(m_Controls->m_BtnDone, SIGNAL(clicked()), this, SLOT(OnClickedDone())); + m_Controls->m_BtnDone->setText("Add Video Device"); + + //Fill Metadata with default information + m_Controls->m_Manufacturer->setText("Unknown Manufacturer"); + m_Controls->m_Model->setText("Unknown Model"); + m_Controls->m_Comment->setText("None"); + 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::ChangeUIEditingUSVideoDevice() +{ + //deactivate the group box containing Videosource options because they should not be changed + m_Controls->m_GroupBoxVideoSource->setEnabled(false); + + //activate the groupbox contaning the options to edit the probes of the device and fill it with information + m_Controls->m_GroupBoxEditProbes->setEnabled(true); + std::vector probes = m_TargetDevice->GetAllProbes(); + for (std::vector::iterator it = probes.begin(); it != probes.end(); it++) + { + std::string probeName = (*it)->GetName(); + m_Controls->m_Probes->addItem(QString::fromUtf8(probeName.data(), probeName.size())); + } + OnProbeChanged(m_Controls->m_Probes->currentText()); + + //Toggle functionality of Btn_Done + m_Controls->m_BtnDone->setText("Save Changes"); + connect(m_Controls->m_BtnDone, SIGNAL(clicked()), this, SLOT(OnClickedFinishedEditing())); + + //Fill Metadata with Information provided by the Device selected to edit + m_Controls->m_Manufacturer->setText(m_TargetDevice->GetManufacturer().c_str()); + m_Controls->m_Model->setText(m_TargetDevice->GetName().c_str()); + m_Controls->m_Comment->setText(m_TargetDevice->GetComment().c_str()); +} + +void QmitkUSNewVideoDeviceWidget::OnClickedAddDepths() +{ + if (!m_Controls->m_Probes->currentText().isEmpty()) + { + std::string probename = m_Controls->m_Probes->currentText().toStdString(); + mitk::USProbe::Pointer currentProbe = m_TargetDevice->GetProbeByName(probename); + QString depths = m_Controls->m_AddDepths->text(); + QStringList singleDepths = depths.split(','); + for (int i = 0; i < singleDepths.size(); i++) + { + currentProbe->SetDepth(singleDepths.at(i).toInt()); + } + m_Controls->m_AddDepths->clear(); + OnProbeChanged(m_Controls->m_Probes->currentText()); + } +} + +void QmitkUSNewVideoDeviceWidget::OnClickedRemoveDepth() +{ + if (!m_Controls->m_Probes->currentText().isEmpty() && !m_Controls->m_Depths->currentText().isEmpty()) + { + std::string probename = m_Controls->m_Probes->currentText().toStdString(); + int indexOfDepthToRemove = m_Controls->m_Depths->currentIndex(); + mitk::USProbe::Pointer currentProbe = m_TargetDevice->GetProbeByName(probename); + currentProbe->RemoveDepth(m_Controls->m_Depths->currentText().toInt()); + m_Controls->m_Depths->removeItem(indexOfDepthToRemove); + } +} + +void QmitkUSNewVideoDeviceWidget::OnClickedRemoveProbe() +{ + if (!m_Controls->m_Probes->currentText().isEmpty()) + { + std::string probename = m_Controls->m_Probes->currentText().toStdString(); + int indexOfProbeToRemove = m_Controls->m_Probes->currentIndex(); + m_TargetDevice->RemoveProbeByName(probename); + m_Controls->m_Probes->removeItem(indexOfProbeToRemove); + } +} + +void QmitkUSNewVideoDeviceWidget::OnProbeChanged(const QString & probename) +{ + if (!probename.isEmpty()) + { + std::string name = probename.toStdString(); + mitk::USProbe::Pointer probe = m_TargetDevice->GetProbeByName(name); + std::map depths = probe->GetDepthsAndSpacing(); + m_Controls->m_Depths->clear(); + for (std::map::iterator it = depths.begin(); it != depths.end(); it++) + { + m_Controls->m_Depths->addItem(QString::number(it->first)); + } + } +} + +void QmitkUSNewVideoDeviceWidget::CleanUpAfterCreatingNewDevice() +{ + disconnect(m_Controls->m_BtnDone, SIGNAL(clicked()), this, SLOT(OnClickedDone())); + m_Controls->m_ProbesInformation->clear(); +} + +void QmitkUSNewVideoDeviceWidget::CleanUpAfterEditingOfDevice() +{ + disconnect(m_Controls->m_BtnDone, SIGNAL(clicked()), this, SLOT(OnClickedFinishedEditing())); + m_Controls->m_Probes->clear(); + m_Controls->m_Depths->clear(); + m_Controls->m_AddDepths->clear(); + m_Controls->m_ProbesInformation->clear(); +} + +void QmitkUSNewVideoDeviceWidget::AddProbesToDevice(mitk::USVideoDevice::Pointer device) +{ + 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()); + } + device->AddNewProbe(probe); + } +} diff --git a/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.h b/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.h index 44e10b4385..4f116f96cd 100644 --- a/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.h +++ b/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidget.h @@ -1,117 +1,130 @@ /*=================================================================== 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 the user clicks the "Done" button (Labeled either "Add Device" or "Edit Device", depending on the situation. + */ + void OnClickedDone(); + + void OnClickedFinishedEditing(); + + /* + \brief Called, when the button "Cancel" was clicked + */ + void OnClickedCancel(); + + /* + \brief Called, when the Use selects one of the Radiobuttons + */ + void OnDeviceTypeSelection(); + + void OnOpenFileButtonClicked(); + + void OnClickedRemoveProbe(); - /* - \brief Called, when the button "Cancel" was clicked - */ - void OnClickedCancel(); + void OnClickedRemoveDepth(); - /* - \brief Called, when the Use selects one of the Radiobuttons - */ - void OnDeviceTypeSelection(); + void OnClickedAddDepths(); - void OnOpenFileButtonClicked(); + void OnProbeChanged(const QString & probename); +protected: + 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 + void ChangeUIEditingUSVideoDevice(); - /* - \brief Constructs a ListItem from the given device for display in the list of active devices - */ - QListWidgetItem* ConstructItemFromDevice(mitk::USDevice::Pointer device); + void CleanUpAfterEditingOfDevice(); - /* - \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; + void CleanUpAfterCreatingNewDevice(); - /** - * \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 AddProbesToDevice(mitk::USVideoDevice::Pointer device); + /* + \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; }; #endif // _QmitkUSNewVideoDeviceWidget_H_INCLUDED diff --git a/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidgetControls.ui b/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidgetControls.ui index ca2feae88e..82f3aeb080 100644 --- a/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidgetControls.ui +++ b/Modules/USUI/Qmitk/QmitkUSNewVideoDeviceWidgetControls.ui @@ -1,395 +1,569 @@ QmitkUSNewVideoDeviceWidgetControls 0 0 330 - 595 + 837 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 ... OIGTL Server false localhost false 1 65535 18944 OIGTL Client false localhost false 1 65535 18944 Video Options: Greyscale Image (Significantly faster) true - + Add Video Device :/USUI/accept.png:/USUI/accept.png Cancel :/USUI/restart.png:/USUI/restart.png - + + + + + 0 + 0 + + + + + 50 + 130 + + + + Add Probes + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + 10 + 100 + 281 + 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 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + false + + + 0 + + + + + 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 + 480 - - + + + + Height: + + + + + + + Enable Resolution Override + + + + + 0 0 10 2048 10 - 480 + 640 - - + + - Height: + 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. - - - - - - Enable Resolution Override + + true - - - - Qt::Vertical + + + + false - + - 20 - 40 + 0 + 180 - + + Edit Probes + + + + + 10 + 40 + 69 + 22 + + + + + + + 10 + 90 + 69 + 22 + + + + + + + 10 + 150 + 71 + 20 + + + + + + + 10 + 20 + 47 + 13 + + + + Probes + + + + + + 10 + 70 + 171 + 16 + + + + Scanning Depths for chosen Probe + + + + + + 10 + 120 + 291 + 31 + + + + Enter Scanning Depths you want to add to chosen Probe. +Seperate them by commas. E.g. 120,150,180 + + + + + + 120 + 90 + 111 + 23 + + + + Remove this Depth + + + + + + 120 + 150 + 111 + 23 + + + + Add Depths + + + + + + 120 + 40 + 111 + 23 + + + + Remove this Probe + + + m_Manufacturer m_Model m_Comment m_RadioDeviceSource m_DeviceSelector m_RadioFileSource m_CheckResolutionOverride 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 196fa4988f..25cbd1abec 100644 --- a/Plugins/org.mitk.gui.qt.ultrasound/src/internal/UltrasoundSupport.cpp +++ b/Plugins/org.mitk.gui.qt.ultrasound/src/internal/UltrasoundSupport.cpp @@ -1,498 +1,500 @@ /*=================================================================== 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 #include #include // Qmitk #include "UltrasoundSupport.h" // Qt #include #include #include // Ultrasound #include "mitkUSDevice.h" #include "QmitkUSAbstractCustomWidget.h" #include #include #include "usServiceReference.h" #include "internal/org_mitk_gui_qt_ultrasound_Activator.h" const std::string UltrasoundSupport::VIEW_ID = "org.mitk.views.ultrasoundsupport"; void UltrasoundSupport::SetFocus() { } -void UltrasoundSupport::CreateQtPartControl( QWidget *parent ) +void UltrasoundSupport::CreateQtPartControl(QWidget *parent) { //initialize timers m_UpdateTimer = new QTimer(this); m_RenderingTimer2d = new QTimer(this); m_RenderingTimer3d = new QTimer(this); // create GUI widgets from the Qt Designer's .ui file - m_Controls.setupUi( parent ); + m_Controls.setupUi(parent); //load persistence data before connecting slots (so no slots are called in this phase...) LoadUISettings(); //connect signals and slots... - connect( m_Controls.m_DeviceManagerWidget, SIGNAL(NewDeviceButtonClicked()), this, SLOT(OnClickedAddNewDevice()) ); // Change Widget Visibilities - connect( m_Controls.m_DeviceManagerWidget, SIGNAL(NewDeviceButtonClicked()), this->m_Controls.m_NewVideoDeviceWidget, SLOT(CreateNewDevice()) ); // Init NewDeviceWidget - connect( m_Controls.m_ActiveVideoDevices, SIGNAL(ServiceSelectionChanged(us::ServiceReferenceU)), this, SLOT(OnChangedActiveDevice()) ); - connect( m_Controls.m_RunImageTimer, SIGNAL(clicked()), this, SLOT(OnChangedActiveDevice()) ); - connect( m_Controls.m_ShowImageStream, SIGNAL(clicked()), this, SLOT(OnChangedActiveDevice()) ); - connect( m_Controls.m_NewVideoDeviceWidget, SIGNAL(Finished()), this, SLOT(OnNewDeviceWidgetDone()) ); // After NewDeviceWidget finished editing - connect( m_Controls.m_FrameRatePipeline, SIGNAL(valueChanged(int)), this, SLOT(OnChangedFramerateLimit()) ); - connect( m_Controls.m_FrameRate2d, SIGNAL(valueChanged(int)), this, SLOT(OnChangedFramerateLimit()) ); - connect( m_Controls.m_FrameRate3d, SIGNAL(valueChanged(int)), this, SLOT(OnChangedFramerateLimit()) ); - connect( m_Controls.m_FreezeButton, SIGNAL(clicked()), this, SLOT(OnClickedFreezeButton()) ); - connect( m_UpdateTimer, SIGNAL(timeout()), this, SLOT(UpdateImage())); - connect( m_RenderingTimer2d, SIGNAL(timeout()), this, SLOT(RenderImage2d())); - connect( m_RenderingTimer3d, SIGNAL(timeout()), this, SLOT(RenderImage3d())); - connect( m_Controls.m_Update2DView, SIGNAL(clicked()), this, SLOT(StartTimers()) ); - connect( m_Controls.m_Update3DView, SIGNAL(clicked()), this, SLOT(StartTimers()) ); + connect(m_Controls.m_DeviceManagerWidget, SIGNAL(NewDeviceButtonClicked()), this, SLOT(OnClickedAddNewDevice())); // Change Widget Visibilities + connect(m_Controls.m_DeviceManagerWidget, SIGNAL(NewDeviceButtonClicked()), this->m_Controls.m_NewVideoDeviceWidget, SLOT(CreateNewDevice())); // Init NewDeviceWidget + connect(m_Controls.m_ActiveVideoDevices, SIGNAL(ServiceSelectionChanged(us::ServiceReferenceU)), this, SLOT(OnChangedActiveDevice())); + connect(m_Controls.m_RunImageTimer, SIGNAL(clicked()), this, SLOT(OnChangedActiveDevice())); + connect(m_Controls.m_ShowImageStream, SIGNAL(clicked()), this, SLOT(OnChangedActiveDevice())); + connect(m_Controls.m_NewVideoDeviceWidget, SIGNAL(Finished()), this, SLOT(OnNewDeviceWidgetDone())); // After NewDeviceWidget finished editing + connect(m_Controls.m_FrameRatePipeline, SIGNAL(valueChanged(int)), this, SLOT(OnChangedFramerateLimit())); + connect(m_Controls.m_FrameRate2d, SIGNAL(valueChanged(int)), this, SLOT(OnChangedFramerateLimit())); + connect(m_Controls.m_FrameRate3d, SIGNAL(valueChanged(int)), this, SLOT(OnChangedFramerateLimit())); + connect(m_Controls.m_FreezeButton, SIGNAL(clicked()), this, SLOT(OnClickedFreezeButton())); + connect(m_UpdateTimer, SIGNAL(timeout()), this, SLOT(UpdateImage())); + connect(m_RenderingTimer2d, SIGNAL(timeout()), this, SLOT(RenderImage2d())); + connect(m_RenderingTimer3d, SIGNAL(timeout()), this, SLOT(RenderImage3d())); + connect(m_Controls.m_Update2DView, SIGNAL(clicked()), this, SLOT(StartTimers())); + connect(m_Controls.m_Update3DView, SIGNAL(clicked()), this, SLOT(StartTimers())); + connect(m_Controls.m_DeviceManagerWidget, SIGNAL(EditDeviceButtonClicked(mitk::USDevice::Pointer)), this, SLOT(OnClickedEditDevice())); //Change Widget Visibilities + connect(m_Controls.m_DeviceManagerWidget, SIGNAL(EditDeviceButtonClicked(mitk::USDevice::Pointer)), this->m_Controls.m_NewVideoDeviceWidget, SLOT(EditDevice(mitk::USDevice::Pointer))); // Initializations m_Controls.m_NewVideoDeviceWidget->setVisible(false); std::string filter = "(&(" + us::ServiceConstants::OBJECTCLASS() + "=" + "org.mitk.services.UltrasoundDevice)(" + mitk::USDevice::GetPropertyKeys().US_PROPKEY_ISACTIVE + "=true))"; m_Controls.m_ActiveVideoDevices->Initialize( - mitk::USDevice::GetPropertyKeys().US_PROPKEY_LABEL ,filter); + mitk::USDevice::GetPropertyKeys().US_PROPKEY_LABEL, filter); m_Controls.m_ActiveVideoDevices->SetAutomaticallySelectFirstEntry(true); m_FrameCounterPipeline = 0; m_FrameCounter2d = 0; m_FrameCounter3d = 0; // Create Node for US Stream if (m_Node.IsNull()) { m_Node = mitk::DataNode::New(); m_Node->SetName("US Support Viewing Stream"); //create a dummy image (gray values 0..255) for correct initialization of level window, etc. - mitk::Image::Pointer dummyImage = mitk::ImageGenerator::GenerateRandomImage(100, 100, 1, 1, 1, 1, 1, 255,0); + mitk::Image::Pointer dummyImage = mitk::ImageGenerator::GenerateRandomImage(100, 100, 1, 1, 1, 1, 1, 255, 0); m_Node->SetData(dummyImage); m_OldGeometry = dynamic_cast(dummyImage->GetGeometry()); } m_Controls.tabWidget->setTabEnabled(1, false); - } void UltrasoundSupport::OnClickedAddNewDevice() { m_Controls.m_NewVideoDeviceWidget->setVisible(true); m_Controls.m_DeviceManagerWidget->setVisible(false); m_Controls.m_Headline->setText("Add New Video Device:"); m_Controls.m_WidgetActiveDevices->setVisible(false); } +void UltrasoundSupport::OnClickedEditDevice() +{ + m_Controls.m_NewVideoDeviceWidget->setVisible(true); + m_Controls.m_DeviceManagerWidget->setVisible(false); + m_Controls.m_WidgetActiveDevices->setVisible(false); + m_Controls.m_Headline->setText("Edit Video Device:"); +} + void UltrasoundSupport::UpdateImage() { //Update device m_Device->Modified(); m_Device->Update(); //Only update the view if the image is shown - if(m_Controls.m_ShowImageStream->isChecked()) + if (m_Controls.m_ShowImageStream->isChecked()) { //Update data node mitk::Image::Pointer curOutput = m_Device->GetOutput(); - if(curOutput->IsEmpty()) + if (curOutput->IsEmpty()) { m_Node->SetName("No Data received yet ..."); //create a noise image for correct initialization of level window, etc. - mitk::Image::Pointer randomImage = mitk::ImageGenerator::GenerateRandomImage(32, 32, 1, 1, 1, 1, 1, 255,0); + mitk::Image::Pointer randomImage = mitk::ImageGenerator::GenerateRandomImage(32, 32, 1, 1, 1, 1, 1, 255, 0); m_Node->SetData(randomImage); curOutput->SetGeometry(randomImage->GetGeometry()); } else { m_Node->SetName("US Support Viewing Stream"); m_Node->SetData(curOutput); } // if the geometry changed: reinitialize the ultrasound image - if((m_OldGeometry.IsNotNull()) && - (curOutput->GetGeometry() != NULL) && - (!mitk::Equal(m_OldGeometry.GetPointer(),curOutput->GetGeometry(),0.0001,false)) + if ((m_OldGeometry.IsNotNull()) && + (curOutput->GetGeometry() != NULL) && + (!mitk::Equal(m_OldGeometry.GetPointer(), curOutput->GetGeometry(), 0.0001, false)) ) { mitk::IRenderWindowPart* renderWindow = this->GetRenderWindowPart(); - if ( (renderWindow != NULL) && (curOutput->GetTimeGeometry()->IsValid()) && (m_Controls.m_ShowImageStream->isChecked()) ) + if ((renderWindow != NULL) && (curOutput->GetTimeGeometry()->IsValid()) && (m_Controls.m_ShowImageStream->isChecked())) { renderWindow->GetRenderingManager()->InitializeViews( - curOutput->GetGeometry(), mitk::RenderingManager::REQUEST_UPDATE_ALL, true ); + curOutput->GetGeometry(), mitk::RenderingManager::REQUEST_UPDATE_ALL, true); renderWindow->GetRenderingManager()->RequestUpdateAll(); } m_CurrentImageWidth = curOutput->GetDimension(0); m_CurrentImageHeight = curOutput->GetDimension(1); m_OldGeometry = dynamic_cast(curOutput->GetGeometry()); } - } //Update frame counter - m_FrameCounterPipeline ++; + m_FrameCounterPipeline++; if (m_FrameCounterPipeline >= 10) { //compute framerate of pipeline update int nMilliseconds = m_Clock.restart(); - int fps = 10000.0f / (nMilliseconds ); + int fps = 10000.0f / (nMilliseconds); m_FPSPipeline = fps; m_FrameCounterPipeline = 0; //display lowest framerate in UI - int lowestFPS=m_FPSPipeline; - if (m_Controls.m_Update2DView->isChecked() && (m_FPS2disChecked() && (m_FPS3dsetText("Current Framerate: "+ QString::number(lowestFPS) +" FPS"); + int lowestFPS = m_FPSPipeline; + if (m_Controls.m_Update2DView->isChecked() && (m_FPS2d < lowestFPS)) { lowestFPS = m_FPS2d; } + if (m_Controls.m_Update3DView->isChecked() && (m_FPS3d < lowestFPS)) { lowestFPS = m_FPS3d; } + m_Controls.m_FramerateLabel->setText("Current Framerate: " + QString::number(lowestFPS) + " FPS"); } } void UltrasoundSupport::RenderImage2d() { this->RequestRenderWindowUpdate(mitk::RenderingManager::REQUEST_UPDATE_2DWINDOWS); - m_FrameCounter2d ++; + m_FrameCounter2d++; if (m_FrameCounter2d >= 10) { //compute framerate of 2d render window update int nMilliseconds = m_Clock2d.restart(); - int fps = 10000.0f / (nMilliseconds ); + int fps = 10000.0f / (nMilliseconds); m_FPS2d = fps; m_FrameCounter2d = 0; } } void UltrasoundSupport::RenderImage3d() { this->RequestRenderWindowUpdate(mitk::RenderingManager::REQUEST_UPDATE_3DWINDOWS); - m_FrameCounter3d ++; + m_FrameCounter3d++; if (m_FrameCounter3d >= 10) { //compute framerate of 2d render window update int nMilliseconds = m_Clock3d.restart(); - int fps = 10000.0f / (nMilliseconds ); + int fps = 10000.0f / (nMilliseconds); m_FPS3d = fps; m_FrameCounter3d = 0; } } void UltrasoundSupport::OnChangedFramerateLimit() { StopTimers(); int intervalPipeline = (1000 / m_Controls.m_FrameRatePipeline->value()); int interval2D = (1000 / m_Controls.m_FrameRate2d->value()); int interval3D = (1000 / m_Controls.m_FrameRate3d->value()); - SetTimerIntervals(intervalPipeline,interval2D,interval3D); + SetTimerIntervals(intervalPipeline, interval2D, interval3D); StartTimers(); } void UltrasoundSupport::OnClickedFreezeButton() { - if ( m_Device.IsNull() ) + if (m_Device.IsNull()) { MITK_WARN("UltrasoundSupport") << "Freeze button clicked though no device is selected."; return; } - if ( m_Device->GetIsFreezed() ) + if (m_Device->GetIsFreezed()) { m_Device->SetIsFreezed(false); m_Controls.m_FreezeButton->setText("Freeze"); } else { m_Device->SetIsFreezed(true); m_Controls.m_FreezeButton->setText("Start Viewing Again"); } } void UltrasoundSupport::OnChangedActiveDevice() { //clean up and stop timer StopTimers(); this->RemoveControlWidgets(); this->GetDataStorage()->Remove(m_Node); m_Node->ReleaseData(); //get current device, abort if it is invalid m_Device = m_Controls.m_ActiveVideoDevices->GetSelectedService(); if (m_Device.IsNull()) { m_Controls.tabWidget->setTabEnabled(1, false); return; } //create the widgets for this device and enable the widget tab this->CreateControlWidgets(); m_Controls.tabWidget->setTabEnabled(1, true); //show node if the option is enabled - if(m_Controls.m_ShowImageStream->isChecked()) + if (m_Controls.m_ShowImageStream->isChecked()) { this->GetDataStorage()->Add(m_Node); } //start timer - if(m_Controls.m_RunImageTimer->isChecked()) + if (m_Controls.m_RunImageTimer->isChecked()) { int intervalPipeline = (1000 / m_Controls.m_FrameRatePipeline->value()); int interval2D = (1000 / m_Controls.m_FrameRate2d->value()); int interval3D = (1000 / m_Controls.m_FrameRate3d->value()); - SetTimerIntervals(intervalPipeline,interval2D,interval3D); + SetTimerIntervals(intervalPipeline, interval2D, interval3D); StartTimers(); m_Controls.m_TimerWidget->setEnabled(true); } else { m_Controls.m_TimerWidget->setEnabled(false); } } void UltrasoundSupport::OnNewDeviceWidgetDone() { m_Controls.m_NewVideoDeviceWidget->setVisible(false); m_Controls.m_DeviceManagerWidget->setVisible(true); m_Controls.m_Headline->setText("Ultrasound Devices:"); m_Controls.m_WidgetActiveDevices->setVisible(true); } void UltrasoundSupport::CreateControlWidgets() { m_ControlProbesWidget = new QmitkUSControlsProbesWidget(m_Device->GetControlInterfaceProbes(), m_Controls.m_ToolBoxControlWidgets); m_Controls.probesWidgetContainer->addWidget(m_ControlProbesWidget); // create b mode widget for current device m_ControlBModeWidget = new QmitkUSControlsBModeWidget(m_Device->GetControlInterfaceBMode(), m_Controls.m_ToolBoxControlWidgets); m_Controls.m_ToolBoxControlWidgets->addItem(m_ControlBModeWidget, "B Mode Controls"); - if ( ! m_Device->GetControlInterfaceBMode() ) + if (!m_Device->GetControlInterfaceBMode()) { - m_Controls.m_ToolBoxControlWidgets->setItemEnabled(m_Controls.m_ToolBoxControlWidgets->count()-1, false); + m_Controls.m_ToolBoxControlWidgets->setItemEnabled(m_Controls.m_ToolBoxControlWidgets->count() - 1, false); } // create doppler widget for current device m_ControlDopplerWidget = new QmitkUSControlsDopplerWidget(m_Device->GetControlInterfaceDoppler(), m_Controls.m_ToolBoxControlWidgets); m_Controls.m_ToolBoxControlWidgets->addItem(m_ControlDopplerWidget, "Doppler Controls"); - if ( ! m_Device->GetControlInterfaceDoppler() ) + if (!m_Device->GetControlInterfaceDoppler()) { - m_Controls.m_ToolBoxControlWidgets->setItemEnabled(m_Controls.m_ToolBoxControlWidgets->count()-1, false); + m_Controls.m_ToolBoxControlWidgets->setItemEnabled(m_Controls.m_ToolBoxControlWidgets->count() - 1, false); } ctkPluginContext* pluginContext = mitk::PluginActivator::GetContext(); - if ( pluginContext ) + if (pluginContext) { std::string filter = "(ork.mitk.services.UltrasoundCustomWidget.deviceClass=" + m_Device->GetDeviceClass() + ")"; - QString interfaceName = QString::fromStdString(us_service_interface_iid() ); + QString interfaceName = QString::fromStdString(us_service_interface_iid()); m_CustomWidgetServiceReference = pluginContext->getServiceReferences(interfaceName, QString::fromStdString(filter)); if (m_CustomWidgetServiceReference.size() > 0) { m_ControlCustomWidget = pluginContext->getService - (m_CustomWidgetServiceReference.at(0))->CloneForQt(m_Controls.tab2); + (m_CustomWidgetServiceReference.at(0))->CloneForQt(m_Controls.tab2); m_ControlCustomWidget->SetDevice(m_Device); m_Controls.m_ToolBoxControlWidgets->addItem(m_ControlCustomWidget, "Custom Controls"); } else { m_Controls.m_ToolBoxControlWidgets->addItem(new QWidget(m_Controls.m_ToolBoxControlWidgets), "Custom Controls"); - m_Controls.m_ToolBoxControlWidgets->setItemEnabled(m_Controls.m_ToolBoxControlWidgets->count()-1, false); + m_Controls.m_ToolBoxControlWidgets->setItemEnabled(m_Controls.m_ToolBoxControlWidgets->count() - 1, false); } - } // select first enabled control widget - for ( int n = 0; n < m_Controls.m_ToolBoxControlWidgets->count(); ++n) + for (int n = 0; n < m_Controls.m_ToolBoxControlWidgets->count(); ++n) { - if ( m_Controls.m_ToolBoxControlWidgets->isItemEnabled(n) ) + if (m_Controls.m_ToolBoxControlWidgets->isItemEnabled(n)) { m_Controls.m_ToolBoxControlWidgets->setCurrentIndex(n); break; } } +} - } - - void UltrasoundSupport::RemoveControlWidgets() - { - if(!m_ControlProbesWidget) {return;} //widgets do not exist... nothing to do +void UltrasoundSupport::RemoveControlWidgets() +{ + if (!m_ControlProbesWidget) { return; } //widgets do not exist... nothing to do // remove all control widgets from the tool box widget while (m_Controls.m_ToolBoxControlWidgets->count() > 0) { m_Controls.m_ToolBoxControlWidgets->removeItem(0); } // remove probes widget (which is not part of the tool box widget) m_Controls.probesWidgetContainer->removeWidget(m_ControlProbesWidget); delete m_ControlProbesWidget; m_ControlProbesWidget = 0; delete m_ControlBModeWidget; m_ControlBModeWidget = 0; delete m_ControlDopplerWidget; m_ControlDopplerWidget = 0; // delete custom widget if it is present - if ( m_ControlCustomWidget ) + if (m_ControlCustomWidget) { ctkPluginContext* pluginContext = mitk::PluginActivator::GetContext(); delete m_ControlCustomWidget; m_ControlCustomWidget = 0; - if ( m_CustomWidgetServiceReference.size() > 0 ) + if (m_CustomWidgetServiceReference.size() > 0) { pluginContext->ungetService(m_CustomWidgetServiceReference.at(0)); } } } - void UltrasoundSupport::OnDeciveServiceEvent(const ctkServiceEvent event) { - if ( m_Device.IsNull() || event.getType() != us::ServiceEvent::MODIFIED ) + if (m_Device.IsNull() || event.getType() != us::ServiceEvent::MODIFIED) { return; } ctkServiceReference service = event.getServiceReference(); - if ( m_Device->GetManufacturer() != service.getProperty(QString::fromStdString(mitk::USDevice::GetPropertyKeys().US_PROPKEY_MANUFACTURER)).toString().toStdString() - && m_Device->GetName() != service.getProperty(QString::fromStdString(mitk::USDevice::GetPropertyKeys().US_PROPKEY_NAME)).toString().toStdString() ) + if (m_Device->GetManufacturer() != service.getProperty(QString::fromStdString(mitk::USDevice::GetPropertyKeys().US_PROPKEY_MANUFACTURER)).toString().toStdString() + && m_Device->GetName() != service.getProperty(QString::fromStdString(mitk::USDevice::GetPropertyKeys().US_PROPKEY_NAME)).toString().toStdString()) { return; } - if ( ! m_Device->GetIsActive() && m_UpdateTimer->isActive() ) + if (!m_Device->GetIsActive() && m_UpdateTimer->isActive()) { StopTimers(); } - if ( m_CurrentDynamicRange != service.getProperty(QString::fromStdString(mitk::USDevice::GetPropertyKeys().US_PROPKEY_BMODE_DYNAMIC_RANGE)).toDouble() ) + if (m_CurrentDynamicRange != service.getProperty(QString::fromStdString(mitk::USDevice::GetPropertyKeys().US_PROPKEY_BMODE_DYNAMIC_RANGE)).toDouble()) { m_CurrentDynamicRange = service.getProperty(QString::fromStdString(mitk::USDevice::GetPropertyKeys().US_PROPKEY_BMODE_DYNAMIC_RANGE)).toDouble(); // update level window for the current dynamic range mitk::LevelWindow levelWindow; m_Node->GetLevelWindow(levelWindow); levelWindow.SetAuto(m_Image, true, true); m_Node->SetLevelWindow(levelWindow); } } UltrasoundSupport::UltrasoundSupport() : m_ControlCustomWidget(0), m_ControlBModeWidget(0), m_ControlProbesWidget(0), m_ImageAlreadySetToNode(false), m_CurrentImageWidth(0), m_CurrentImageHeight(0) { ctkPluginContext* pluginContext = mitk::PluginActivator::GetContext(); - if ( pluginContext ) + if (pluginContext) { // to be notified about service event of an USDevice pluginContext->connectServiceListener(this, "OnDeciveServiceEvent", - QString::fromStdString("(" + us::ServiceConstants::OBJECTCLASS() + "=" + us_service_interface_iid() + ")")); + QString::fromStdString("(" + us::ServiceConstants::OBJECTCLASS() + "=" + us_service_interface_iid() + ")")); } - } UltrasoundSupport::~UltrasoundSupport() { try { StopTimers(); // Get all active devicesand deactivate them to prevent freeze std::vector devices = this->m_Controls.m_ActiveVideoDevices->GetAllServices(); - for (int i = 0; i < devices.size(); i ++) + for (int i = 0; i < devices.size(); i++) { - mitk::USDevice::Pointer device = devices[i]; - if (device.IsNotNull() && device->GetIsActive()) - { - device->Deactivate(); - device->Disconnect(); - } + mitk::USDevice::Pointer device = devices[i]; + if (device.IsNotNull() && device->GetIsActive()) + { + device->Deactivate(); + device->Disconnect(); + } } StoreUISettings(); } - catch(std::exception &e) + catch (std::exception &e) { MITK_ERROR << "Exception during call of destructor! Message: " << e.what(); } - } void UltrasoundSupport::StoreUISettings() { QSettings settings; settings.beginGroup(QString::fromStdString(VIEW_ID)); settings.setValue("DisplayImage", QVariant(m_Controls.m_ShowImageStream->isChecked())); settings.setValue("RunImageTimer", QVariant(m_Controls.m_RunImageTimer->isChecked())); settings.setValue("Update2DView", QVariant(m_Controls.m_Update2DView->isChecked())); settings.setValue("Update3DView", QVariant(m_Controls.m_Update3DView->isChecked())); settings.setValue("UpdateRatePipeline", QVariant(m_Controls.m_FrameRatePipeline->value())); settings.setValue("UpdateRate2d", QVariant(m_Controls.m_FrameRate2d->value())); settings.setValue("UpdateRate3d", QVariant(m_Controls.m_FrameRate3d->value())); settings.endGroup(); } void UltrasoundSupport::LoadUISettings() { QSettings settings; settings.beginGroup(QString::fromStdString(VIEW_ID)); m_Controls.m_ShowImageStream->setChecked(settings.value("DisplayImage", true).toBool()); m_Controls.m_RunImageTimer->setChecked(settings.value("RunImageTimer", true).toBool()); m_Controls.m_Update2DView->setChecked(settings.value("Update2DView", true).toBool()); m_Controls.m_Update3DView->setChecked(settings.value("Update3DView", true).toBool()); m_Controls.m_FrameRatePipeline->setValue(settings.value("UpdateRatePipeline", 50).toInt()); m_Controls.m_FrameRate2d->setValue(settings.value("UpdateRate2d", 20).toInt()); m_Controls.m_FrameRate3d->setValue(settings.value("UpdateRate3d", 5).toInt()); settings.endGroup(); - } void UltrasoundSupport::StartTimers() { m_UpdateTimer->start(); - if (m_Controls.m_Update2DView->isChecked()) {m_RenderingTimer2d->start();} - if (m_Controls.m_Update3DView->isChecked()) {m_RenderingTimer3d->start();} + if (m_Controls.m_Update2DView->isChecked()) { m_RenderingTimer2d->start(); } + if (m_Controls.m_Update3DView->isChecked()) { m_RenderingTimer3d->start(); } } void UltrasoundSupport::StopTimers() { m_UpdateTimer->stop(); m_RenderingTimer2d->stop(); m_RenderingTimer3d->stop(); } void UltrasoundSupport::SetTimerIntervals(int intervalPipeline, int interval2D, int interval3D) { m_UpdateTimer->setInterval(intervalPipeline); m_RenderingTimer2d->setInterval(interval2D); m_RenderingTimer3d->setInterval(interval3D); } diff --git a/Plugins/org.mitk.gui.qt.ultrasound/src/internal/UltrasoundSupport.h b/Plugins/org.mitk.gui.qt.ultrasound/src/internal/UltrasoundSupport.h index bdaec7fefd..7275eb4796 100644 --- a/Plugins/org.mitk.gui.qt.ultrasound/src/internal/UltrasoundSupport.h +++ b/Plugins/org.mitk.gui.qt.ultrasound/src/internal/UltrasoundSupport.h @@ -1,149 +1,150 @@ /*=================================================================== 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 UltrasoundSupport_h #define UltrasoundSupport_h #include #include #include "ui_UltrasoundSupportControls.h" #include "QmitkUSAbstractCustomWidget.h" #include "QmitkUSControlsBModeWidget.h" #include "QmitkUSControlsDopplerWidget.h" #include "QmitkUSControlsProbesWidget.h" #include #include /*! \brief UltrasoundSupport This plugin provides functionality to manage Ultrasound devices, create video devices and to view device images. \sa QmitkFunctionality \ingroup ${plugin_target}_internal */ class UltrasoundSupport : public QmitkAbstractView { // this is needed for all Qt objects that should have a Qt meta-object // (everything that derives from QObject and wants to have signal/slots) Q_OBJECT - public: +public: - virtual void SetFocus() override; + virtual void SetFocus() override; - static const std::string VIEW_ID; + static const std::string VIEW_ID; - virtual void CreateQtPartControl(QWidget *parent) override; + virtual void CreateQtPartControl(QWidget *parent) override; - UltrasoundSupport(); - virtual ~UltrasoundSupport(); + UltrasoundSupport(); + virtual ~UltrasoundSupport(); public slots: - /* - * \brief This is called when the newDeviceWidget is closed - */ - void OnNewDeviceWidgetDone(); + /* + * \brief This is called when the newDeviceWidget is closed + */ + void OnNewDeviceWidgetDone(); protected slots: - void OnClickedAddNewDevice(); + void OnClickedAddNewDevice(); - void OnChangedFramerateLimit(); + void OnChangedFramerateLimit(); - /* - *\brief Called, when the selection in the list of the active devices changes. - */ - void OnChangedActiveDevice(); + void OnClickedEditDevice(); - void OnClickedFreezeButton(); + /* + *\brief Called, when the selection in the list of the active devices changes. + */ + void OnChangedActiveDevice(); - void OnDeciveServiceEvent(const ctkServiceEvent event); + void OnClickedFreezeButton(); - /* - * \brief This is the main imaging loop that updates the image and is called regularily during the imaging process - */ - void UpdateImage(); + void OnDeciveServiceEvent(const ctkServiceEvent event); - void RenderImage2d(); + /* + * \brief This is the main imaging loop that updates the image and is called regularily during the imaging process + */ + void UpdateImage(); - void RenderImage3d(); + void RenderImage2d(); - void StartTimers(); + void RenderImage3d(); - void StopTimers(); + void StartTimers(); - protected: + void StopTimers(); - void CreateControlWidgets(); - void RemoveControlWidgets(); +protected: - /** The device that is currently used to aquire images */ - mitk::USDevice::Pointer m_Device; + void CreateControlWidgets(); + void RemoveControlWidgets(); + /** The device that is currently used to aquire images */ + mitk::USDevice::Pointer m_Device; - void SetTimerIntervals(int intervalPipeline, int interval2D, int interval3D); - /** This timer triggers periodic updates to the pipeline */ - QTimer* m_UpdateTimer; - QTimer* m_RenderingTimer2d; - QTimer* m_RenderingTimer3d; + void SetTimerIntervals(int intervalPipeline, int interval2D, int interval3D); + /** This timer triggers periodic updates to the pipeline */ + QTimer* m_UpdateTimer; + QTimer* m_RenderingTimer2d; + QTimer* m_RenderingTimer3d; - /** These clocks are used to compute the framerate in the methods DisplayImage(),RenderImage2d() and RenderImage3d(). */ - QTime m_Clock; - QTime m_Clock2d; - QTime m_Clock3d; + /** These clocks are used to compute the framerate in the methods DisplayImage(),RenderImage2d() and RenderImage3d(). */ + QTime m_Clock; + QTime m_Clock2d; + QTime m_Clock3d; - /** A counter to comute the framerate. */ - int m_FrameCounterPipeline; - int m_FrameCounter2d; - int m_FrameCounter3d; - int m_FPSPipeline, m_FPS2d, m_FPS3d; + /** A counter to comute the framerate. */ + int m_FrameCounterPipeline; + int m_FrameCounter2d; + int m_FrameCounter3d; + int m_FPSPipeline, m_FPS2d, m_FPS3d; - /** Stores the properties of some QWidgets (and the tool storage file name) to QSettings.*/ - void StoreUISettings(); + /** Stores the properties of some QWidgets (and the tool storage file name) to QSettings.*/ + void StoreUISettings(); - /** Loads the properties of some QWidgets (and the tool storage file name) from QSettings.*/ - void LoadUISettings(); + /** Loads the properties of some QWidgets (and the tool storage file name) from QSettings.*/ + void LoadUISettings(); - /** The node that we feed images into.*/ - mitk::DataNode::Pointer m_Node; + /** The node that we feed images into.*/ + mitk::DataNode::Pointer m_Node; - /** The image that is hold by the node above.*/ - mitk::Image::Pointer m_Image; + /** The image that is hold by the node above.*/ + mitk::Image::Pointer m_Image; - /** The old geometry of m_Image. It is needed to check if the geometry changed (e.g. because - * the zoom factor was modified) and the image needs to be reinitialized. */ - mitk::SlicedGeometry3D::Pointer m_OldGeometry; + /** The old geometry of m_Image. It is needed to check if the geometry changed (e.g. because + * the zoom factor was modified) and the image needs to be reinitialized. */ + mitk::SlicedGeometry3D::Pointer m_OldGeometry; - Ui::UltrasoundSupportControls m_Controls; + Ui::UltrasoundSupportControls m_Controls; - QmitkUSAbstractCustomWidget* m_ControlCustomWidget; - QmitkUSControlsBModeWidget* m_ControlBModeWidget; - QmitkUSControlsDopplerWidget* m_ControlDopplerWidget; - QmitkUSControlsProbesWidget* m_ControlProbesWidget; + QmitkUSAbstractCustomWidget* m_ControlCustomWidget; + QmitkUSControlsBModeWidget* m_ControlBModeWidget; + QmitkUSControlsDopplerWidget* m_ControlDopplerWidget; + QmitkUSControlsProbesWidget* m_ControlProbesWidget; - QList m_CustomWidgetServiceReference; + QList m_CustomWidgetServiceReference; - bool m_ImageAlreadySetToNode; - unsigned int m_CurrentImageWidth; - unsigned int m_CurrentImageHeight; - double m_CurrentDynamicRange; + bool m_ImageAlreadySetToNode; + unsigned int m_CurrentImageWidth; + unsigned int m_CurrentImageHeight; + double m_CurrentDynamicRange; }; #endif // UltrasoundSupport_h