diff --git a/Modules/ToFHardware/mitkAbstractToFDeviceFactory.cpp b/Modules/ToFHardware/mitkAbstractToFDeviceFactory.cpp index 0eafe3e586..8a1de8ce7a 100644 --- a/Modules/ToFHardware/mitkAbstractToFDeviceFactory.cpp +++ b/Modules/ToFHardware/mitkAbstractToFDeviceFactory.cpp @@ -1,87 +1,86 @@ /*=================================================================== 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 "mitkAbstractToFDeviceFactory.h" #include #include //Microservices #include #include #include #include #include -//TinyXML #include mitk::ToFCameraDevice::Pointer mitk::AbstractToFDeviceFactory::ConnectToFDevice() { - ToFCameraDevice::Pointer device = CreateToFCameraDevice(); - mitk::CameraIntrinsics::Pointer cameraIntrinsics = GetCameraIntrinsics(); - device->SetProperty("CameraIntrinsics", mitk::CameraIntrinsicsProperty::New(cameraIntrinsics)); - m_Devices.push_back(device); + ToFCameraDevice::Pointer device = CreateToFCameraDevice(); + mitk::CameraIntrinsics::Pointer cameraIntrinsics = GetCameraIntrinsics(); + device->SetProperty("CameraIntrinsics", mitk::CameraIntrinsicsProperty::New(cameraIntrinsics)); + m_Devices.push_back(device); us::ModuleContext* context = us::GetModuleContext(); us::ServiceProperties deviceProps; deviceProps["ToFDeviceName"] = GetCurrentDeviceName(); m_DeviceRegistrations.insert(std::make_pair(device.GetPointer(), context->RegisterService(device.GetPointer(),deviceProps))); return device; } void mitk::AbstractToFDeviceFactory::DisconnectToFDevice(const ToFCameraDevice::Pointer& device) { std::map >::iterator i = m_DeviceRegistrations.find(device.GetPointer()); if (i == m_DeviceRegistrations.end()) return; i->second.Unregister(); m_DeviceRegistrations.erase(i); m_Devices.erase(std::remove(m_Devices.begin(), m_Devices.end(), device), m_Devices.end()); } size_t mitk::AbstractToFDeviceFactory::GetNumberOfDevices() { return m_Devices.size(); } mitk::CameraIntrinsics::Pointer mitk::AbstractToFDeviceFactory::GetCameraIntrinsics() { us::ModuleResource resource = GetIntrinsicsResource(); if (! resource.IsValid()) { MITK_WARN << "Could not load resource '" << resource.GetName() << "'. CameraIntrinsics are invalid!"; } // Create ResourceStream from Resource us::ModuleResourceStream resStream(resource); // Parse XML TiXmlDocument xmlDocument; resStream >> xmlDocument; //Retrieve Child Element and convert to CamerIntrinsics TiXmlElement* element = xmlDocument.FirstChildElement(); mitk::CameraIntrinsics::Pointer intrinsics = mitk::CameraIntrinsics::New(); intrinsics->FromXML(element); return intrinsics; } us::ModuleResource mitk::AbstractToFDeviceFactory::GetIntrinsicsResource() { us::Module* module = us::GetModuleContext()->GetModule(); return module->GetResource("CalibrationFiles/Default_Parameters.xml"); MITK_WARN << "Loaded Default CameraIntrinsics. Overwrite AbstractToFDeviceFactory::GetIntrinsicsResource() if you want to define your own."; } diff --git a/Modules/ToFUI/Qmitk/QmitkStructureSensorParameterWidget.cpp b/Modules/ToFUI/Qmitk/QmitkStructureSensorParameterWidget.cpp new file mode 100644 index 0000000000..d622b26926 --- /dev/null +++ b/Modules/ToFUI/Qmitk/QmitkStructureSensorParameterWidget.cpp @@ -0,0 +1,100 @@ +/*=================================================================== + +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 + +const std::string QmitkStructureSensorParameterWidget::VIEW_ID = "org.mitk.views.qmitkStructureSensorparameterwidget"; + +QmitkStructureSensorParameterWidget::QmitkStructureSensorParameterWidget(QWidget* p, Qt::WindowFlags f): QWidget(p, f) +{ + m_ToFImageGrabber = NULL; + m_Controls = NULL; + CreateQtPartControl(this); +} + +QmitkStructureSensorParameterWidget::~QmitkStructureSensorParameterWidget() +{ +} + +void QmitkStructureSensorParameterWidget::CreateQtPartControl(QWidget *parent) +{ + if (!m_Controls) + { + // create GUI widgets + m_Controls = new Ui::QmitkStructureSensorParameterWidgetControls; + m_Controls->setupUi(parent); + + this->CreateConnections(); + } +} + +void QmitkStructureSensorParameterWidget::CreateConnections() +{ + if ( m_Controls ) + { + connect( m_Controls->m_640, SIGNAL(toggled(bool)), this, SLOT(OnResolutionChanged()) ); + connect( m_Controls->m_320, SIGNAL(toggled(bool)), this, SLOT(OnResolutionChanged()) ); + } +} + +mitk::ToFImageGrabber* QmitkStructureSensorParameterWidget::GetToFImageGrabber() +{ + return this->m_ToFImageGrabber; +} + +void QmitkStructureSensorParameterWidget::SetToFImageGrabber(mitk::ToFImageGrabber* aToFImageGrabber) +{ + this->m_ToFImageGrabber = aToFImageGrabber; +} + +void QmitkStructureSensorParameterWidget::ActivateAllParameters() +{ + this->OnResolutionChanged(); +} + +void QmitkStructureSensorParameterWidget::OnResolutionChanged() +{ + if (m_ToFImageGrabber.IsNotNull()) + { + if (!m_ToFImageGrabber->IsCameraConnected()) + { + //for know depth and RGB resolution is the same, but this could be different in future + this->m_ToFImageGrabber->SetIntProperty("RGBResolution", GetSelectedResolution()); + this->m_ToFImageGrabber->SetIntProperty("DepthResolution", GetSelectedResolution()); + } + else + { + MITK_WARN << "Structure Sensor resolution cannot be changed, if the device is connected. Please disconnect first."; + } + } +} + +int QmitkStructureSensorParameterWidget::GetSelectedResolution() +{ + if(m_Controls->m_640->isChecked()) + { + return 640; + } + else if(m_Controls->m_320->isChecked()) + { + return 320; + } + else + { + MITK_ERROR << "Unsupported structure sensor resolution!"; + return -1; + } +} diff --git a/Modules/ToFUI/Qmitk/QmitkStructureSensorParameterWidget.h b/Modules/ToFUI/Qmitk/QmitkStructureSensorParameterWidget.h new file mode 100644 index 0000000000..7df606dee3 --- /dev/null +++ b/Modules/ToFUI/Qmitk/QmitkStructureSensorParameterWidget.h @@ -0,0 +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. + +===================================================================*/ + +#ifndef QmitkStructureSensorParameterWidget_h +#define QmitkStructureSensorParameterWidget_h + +#include "MitkToFUIExports.h" +#include "ui_QmitkStructureSensorParameterWidgetControls.h" + +#include + +#include + +/** +* @brief Widget for configuring the Structure Sensor device (Occipital, Inc.) +* +* @note This device is currently not available open-source, because the required WiFi +* protocol is part of the commercial mbits source code (http://mbits.info/). If you +* want to use the device please contact mitk-users@dkfz-heidelberg.de. +* +* @ingroup ToFUI +*/ +class MitkToFUI_EXPORT QmitkStructureSensorParameterWidget :public QWidget +{ + //this is needed for all Qt objects that should have a MOC object (everything that derives from QObject) + Q_OBJECT + + public: + + static const std::string VIEW_ID; + + QmitkStructureSensorParameterWidget(QWidget* p = 0, Qt::WindowFlags f = 0); + virtual ~QmitkStructureSensorParameterWidget(); + + /* @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 returns the ToFImageGrabber + \return ToFImageGrabber currently used by the widget + */ + mitk::ToFImageGrabber* GetToFImageGrabber(); + + /*! + \brief sets the ToFImageGrabber + */ + void SetToFImageGrabber(mitk::ToFImageGrabber* aToFImageGrabber); + + /*! + \brief activate camera settings according to the parameters from GUI + */ + void ActivateAllParameters(); + + /** + * @brief GetSelectedResolution getter for 640/320 resolution. + * @return 320: 320x240, 640: 640x480 else -1 and a warning. + */ + int GetSelectedResolution(); + + protected slots: + /** + * @brief OnResolutionChanged called when the resolution combobox is changed. + */ + void OnResolutionChanged(); + + protected: + + Ui::QmitkStructureSensorParameterWidgetControls* m_Controls; ///< member holding the UI elements of this widget + + mitk::ToFImageGrabber::Pointer m_ToFImageGrabber; ///< image grabber object to be configured by the widget +}; + +#endif // QmitkStructureSensorParameterWidget_h diff --git a/Modules/ToFUI/Qmitk/QmitkStructureSensorParameterWidgetControls.ui b/Modules/ToFUI/Qmitk/QmitkStructureSensorParameterWidgetControls.ui new file mode 100644 index 0000000000..d9038fdb8c --- /dev/null +++ b/Modules/ToFUI/Qmitk/QmitkStructureSensorParameterWidgetControls.ui @@ -0,0 +1,76 @@ + + + QmitkStructureSensorParameterWidgetControls + + + + 0 + 0 + 382 + 99 + + + + + 0 + 0 + + + + QmitkToFMESAParameter + + + + + + + 0 + 0 + + + + Structure Sensor Parameter + + + + + + Resolution (requires reconnection) + + + + + + + Acquire RGB and range image + + + 640 x 480 + + + false + + + + + + + Acquire infrared (IR) and range image + + + 320 x 240 + + + true + + + + + + + + + + + + diff --git a/Modules/ToFUI/Qmitk/QmitkToFConnectionWidget.cpp b/Modules/ToFUI/Qmitk/QmitkToFConnectionWidget.cpp index d382795302..9660a0dddd 100644 --- a/Modules/ToFUI/Qmitk/QmitkToFConnectionWidget.cpp +++ b/Modules/ToFUI/Qmitk/QmitkToFConnectionWidget.cpp @@ -1,385 +1,398 @@ /*=================================================================== 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 #include #include //mitk headers #include "mitkToFConfig.h" #include "mitkCameraIntrinsics.h" #include "mitkCameraIntrinsicsProperty.h" //itk headers #include //Setting the View_ID const std::string QmitkToFConnectionWidget::VIEW_ID = "org.mitk.views.qmitktofconnectionwidget2"; //Constructor of QmitkToFConnectionWidget QmitkToFConnectionWidget::QmitkToFConnectionWidget(QWidget* parent, Qt::WindowFlags f): QWidget(parent, f) , m_Controls(NULL) , m_IntegrationTime(0) , m_ModulationFrequency(0) , m_SelectedCameraName("") { this->m_ToFImageGrabber = mitk::ToFImageGrabber::New(); //Calling CreateQtPartControl CreateQtPartControl(this); } //Destructor of QmitkToFConnectionWidget QmitkToFConnectionWidget::~QmitkToFConnectionWidget() { //MitkServiceListWidget must not be deinizialized here. Qmitk methods destroy their children automatically before self-destruction } void QmitkToFConnectionWidget::CreateQtPartControl(QWidget *parent) //Definition of CreateQtPartControll-Methode in QmitkToFConnectionWidget; Input= Pointer { if (!m_Controls) //Define if not alreaddy exists { // create GUI widgets m_Controls = new Ui::QmitkToFConnectionWidgetControls2; m_Controls->setupUi(parent); //and hide them on startup this->HideAllParameterWidgets(); // initzializing MitkServiceListWidget here std::string empty= ""; m_Controls->m_DeviceList->Initialize("ToFDeviceName", empty);// the empty could just be any kind of filter this->CreateConnections(); } } //Creating the SIGNAL-SLOT-Connectuions void QmitkToFConnectionWidget::CreateConnections() { if ( m_Controls ) { //ConnectCameraButton as a trigger for OnConnectCamera() connect( (QObject*)(m_Controls->m_ConnectCameraButton), SIGNAL(clicked()),(QObject*) this, SLOT(OnConnectCamera()) ); //QmitkServiceListWidget::ServiceSelectionChanged as a Signal for the OnSlectCamera() slot connect( m_Controls->m_DeviceList, SIGNAL(ServiceSelectionChanged(us::ServiceReferenceU)), this, SLOT(OnSelectCamera())); /*Creating an other Datanode structur for Kinect is done here: As soon as a Kinect is connected, the KinectParameterWidget is enabled, which can be used to trigger the KinectAcqusitionModeChanged-Method, to create a working Data-Node-structure*/ connect( m_Controls->m_KinectParameterWidget, SIGNAL(AcquisitionModeChanged()), this, SIGNAL(KinectAcquisitionModeChanged()) ); - } } mitk::ToFImageGrabber::Pointer QmitkToFConnectionWidget::GetToFImageGrabber() { return m_ToFImageGrabber; } //The OnSelectCamer-Method is in charge of activating the appropiate ParameterWidgets void QmitkToFConnectionWidget::OnSelectCamera() { //Here we are getting our decvie through the QmitkServiceListWidget-Instance m_DeviceList through the GetSelectedService-Method mitk::ToFCameraDevice* device = m_Controls->m_DeviceList->GetSelectedService(); //getting the selectedCamera through a static Method used to transform the device->GetNameOfClass QString selectedCamera = QString::fromStdString(device->GetNameOfClass()); this->HideAllParameterWidgets(); //reactivating the Widgets on slecting a device if (selectedCamera.contains("PMD")) //Check if selectedCamera string contains ".." for each device { this->m_Controls->m_PMDParameterWidget->show(); //and activate the correct widget } else if (selectedCamera.contains("MESA")) { this->m_Controls->m_MESAParameterWidget->show(); } else if (selectedCamera.contains("Kinect")) { this->m_Controls->m_KinectParameterWidget->show(); } + else if (selectedCamera.contains("Structure")) + { + this->m_Controls->m_StructureParameterWidget->show(); + } m_Controls->m_ConnectCameraButton->setEnabled(true); //ConnectCameraButton gets enabled m_SelectedCameraName = selectedCamera; emit (selectedCamera); } //This Methods hides all Widgets (later each widget is activated on its own) void QmitkToFConnectionWidget::HideAllParameterWidgets() { this->m_Controls->m_PMDParameterWidget->hide(); this->m_Controls->m_MESAParameterWidget->hide(); this->m_Controls->m_KinectParameterWidget->hide(); + this->m_Controls->m_StructureParameterWidget->hide(); } //OnConnectCamera-Method; represents one of the main parts of ToFConnectionWidget2. void QmitkToFConnectionWidget::OnConnectCamera() { //After connecting a device if (m_Controls->m_ConnectCameraButton->text()=="Connect") { //Getting the device- and the slectedCamera-variables using the ServiceListWidget as we did it in the CameraSelect-Method mitk::ToFCameraDevice* device = m_Controls->m_DeviceList->GetSelectedService(); if (device) { QString tmpFileName(""); QString fileFilter(""); QString selectedCamera = QString::fromStdString(device->GetNameOfClass()); emit ToFCameraSelected(selectedCamera); //Feeding it with the Info from ServiceListWidget this->m_ToFImageGrabber->SetCameraDevice(device); - // Calling Alex FixForKinect, if the Kinect is selected if (selectedCamera.contains("Kinect") ) { - MITK_INFO<< "Kinect is connected here"; //If the particular property is selected, the suitable data-node will be generated this->m_ToFImageGrabber->SetBoolProperty("RGB", m_Controls->m_KinectParameterWidget->IsAcquisitionModeRGB()); this->m_ToFImageGrabber->SetBoolProperty("IR", m_Controls->m_KinectParameterWidget->IsAcquisitionModeIR()); } + if (selectedCamera.contains("Structure") ) + { + this->m_ToFImageGrabber->SetIntProperty("RGBResolution", m_Controls->m_StructureParameterWidget->GetSelectedResolution()); + this->m_ToFImageGrabber->SetIntProperty("DepthResolution", m_Controls->m_StructureParameterWidget->GetSelectedResolution()); + } + //Activation of "PlayerMode". If the selectedCamera String contains "Player", we start the Player Mode if (selectedCamera.contains("Player")) { //IF PMD-Player selected if (selectedCamera.contains("PMD")) { fileFilter.append("PMD Files (*.pmd)"); //And seting the corresponding fileFilter } else { fileFilter.append("NRRD Images (*.nrrd);;PIC Images - deprecated (*.pic)"); } //open a QFileDialog to chose the corresponding file from the disc tmpFileName = QFileDialog::getOpenFileName(NULL, "Play Image From...", "", fileFilter); //If no fileName is returned by the Dialog,Button and Widget have to return to default(disconnected) + Opening a MessageBox if (tmpFileName.isEmpty()) { m_Controls->m_ConnectCameraButton->setChecked(false); m_Controls->m_ConnectCameraButton->setEnabled(true); //re-enabling the ConnectCameraButton m_Controls->m_DeviceList->setEnabled(true); //Reactivating ServiceListWidget this->OnSelectCamera(); //Calling the OnSelctCamera-Method -> Hides all Widget and just activates the needed ones QMessageBox::information( this, "Template functionality", "Please select a valid image before starting some action."); return; } if(selectedCamera.contains("PMDPlayer")) //If PMD-Player is selected, set ToFImageGrabberProperty correspondingly { this->m_ToFImageGrabber->SetStringProperty("PMDFileName", tmpFileName.toStdString().c_str() ); } else //Default action { std::string msg = ""; try { //get 3 corresponding file names std::string dir = itksys::SystemTools::GetFilenamePath( tmpFileName.toStdString() ); std::string baseFilename = itksys::SystemTools::GetFilenameWithoutLastExtension( tmpFileName.toStdString() ); std::string extension = itksys::SystemTools::GetFilenameLastExtension( tmpFileName.toStdString() ); //"Incorrect format"-warning while using .nrrd or .pic files if (extension != ".pic" && extension != ".nrrd") { msg = msg + "Invalid file format, please select a \".nrrd\"-file"; throw std::logic_error(msg.c_str()); } //Checking for npos. If available, check for the Amplitude-, Intensity- and RGBImage int found = baseFilename.rfind("_DistanceImage"); //Defining "found" variable+checking if baseFilname contains "_DistanceImage". If not, found == npos(0) if (found == static_cast(std::string::npos)) //If found =0 { found = baseFilename.rfind("_AmplitudeImage"); //If "_AmplitudeImage" is found, the found variable is 1-> the next if statment is false } if (found == static_cast(std::string::npos)) { found = baseFilename.rfind("_IntensityImage"); //found = true if baseFilename cotains "_IntesityImage" } if (found == static_cast(std::string::npos)) { found = baseFilename.rfind("_RGBImage"); } if (found == static_cast(std::string::npos)) //If none of the Nodes is found, display an error { msg = msg + "Input file name must end with \"_DistanceImage\", \"_AmplitudeImage\", \"_IntensityImage\" or \"_RGBImage\"!"; throw std::logic_error(msg.c_str()); } std::string baseFilenamePrefix = baseFilename.substr(0,found);//Set the baseFilenamePrefix as a substring from baseFilname //Set corresponding FileNames std::string distanceImageFileName = dir + "/" + baseFilenamePrefix + "_DistanceImage" + extension; //Set the name as: directory+FilenamePrefix+""+extension std::string amplitudeImageFileName = dir + "/" + baseFilenamePrefix + "_AmplitudeImage" + extension; std::string intensityImageFileName = dir + "/" + baseFilenamePrefix + "_IntensityImage" + extension; std::string rgbImageFileName = dir + "/" + baseFilenamePrefix + "_RGBImage" + extension; if (!itksys::SystemTools::FileExists(distanceImageFileName.c_str(), true)) { this->m_ToFImageGrabber->SetStringProperty("DistanceImageFileName", ""); } else { this->m_ToFImageGrabber->SetStringProperty("DistanceImageFileName", distanceImageFileName.c_str()); } if (!itksys::SystemTools::FileExists(amplitudeImageFileName.c_str(), true)) { } else { this->m_ToFImageGrabber->SetStringProperty("AmplitudeImageFileName", amplitudeImageFileName.c_str()); } if (!itksys::SystemTools::FileExists(intensityImageFileName.c_str(), true)) { this->m_ToFImageGrabber->SetStringProperty("IntensityImageFileName", ""); } else { this->m_ToFImageGrabber->SetStringProperty("IntensityImageFileName", intensityImageFileName.c_str()); } if (!itksys::SystemTools::FileExists(rgbImageFileName.c_str(), true)) { this->m_ToFImageGrabber->SetStringProperty("RGBImageFileName", ""); } else { this->m_ToFImageGrabber->SetStringProperty("RGBImageFileName", rgbImageFileName.c_str()); } } catch (std::exception &e) { MITK_ERROR << e.what(); QMessageBox::critical( this, "Error", e.what() ); m_Controls->m_ConnectCameraButton->setChecked(false); m_Controls->m_ConnectCameraButton->setEnabled(true); m_Controls->m_DeviceList->setEnabled(true); this->OnSelectCamera(); return; } } } //End "PlayerMode" //Reset the ConnectCameraButton to disconnected m_Controls->m_ConnectCameraButton->setText("Disconnect"); //if a connection could be established try { if (this->m_ToFImageGrabber->ConnectCamera()) { this->m_Controls->m_PMDParameterWidget->SetToFImageGrabber(this->m_ToFImageGrabber); this->m_Controls->m_MESAParameterWidget->SetToFImageGrabber(this->m_ToFImageGrabber); this->m_Controls->m_KinectParameterWidget->SetToFImageGrabber(this->m_ToFImageGrabber); + this->m_Controls->m_StructureParameterWidget->SetToFImageGrabber(this->m_ToFImageGrabber); //Activating the respective widgets if (selectedCamera.contains("PMD")) { this->m_Controls->m_PMDParameterWidget->ActivateAllParameters(); } else if (selectedCamera.contains("MESA")) { this->m_Controls->m_MESAParameterWidget->ActivateAllParameters(); } else if (selectedCamera.contains("Kinect")) { this->m_Controls->m_KinectParameterWidget->ActivateAllParameters(); } + else if (selectedCamera.contains("Structure")) + { + this->m_Controls->m_StructureParameterWidget->ActivateAllParameters(); + } else { this->HideAllParameterWidgets(); } // send connect signal to the caller functionality emit ToFCameraConnected(); } else //##### TODO: Remove this else part once all controllers are throwing exceptions //if they cannot to any device! { //Throw an error if the Connection failed and reset the Widgets <- better catch an exception! QMessageBox::critical( this, "Error", "Connection failed. Check if you have installed the latest driver for your system." ); m_Controls->m_ConnectCameraButton->setChecked(false); m_Controls->m_ConnectCameraButton->setEnabled(true); m_Controls->m_ConnectCameraButton->setText("Connect"); m_Controls->m_DeviceList->setEnabled(true); //Reactivating ServiceListWidget this->OnSelectCamera(); return; } }catch(std::exception &e) { //catch exceptions of camera which cannot connect give a better reason QMessageBox::critical( this, "Connection failed.", e.what() ); m_Controls->m_ConnectCameraButton->setChecked(false); m_Controls->m_ConnectCameraButton->setEnabled(true); m_Controls->m_ConnectCameraButton->setText("Connect"); m_Controls->m_DeviceList->setEnabled(true); //Reactivating ServiceListWidget this->OnSelectCamera(); return; } m_Controls->m_ConnectCameraButton->setEnabled(true); // ask wether camera parameters (intrinsics, ...) should be loaded if (QMessageBox::question(this,"Camera parameters","Do you want to specify your own camera intrinsics?",QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes) { try { QString fileName = QFileDialog::getOpenFileName(this,"Open camera intrinsics","/","*.xml"); mitk::CameraIntrinsics::Pointer cameraIntrinsics = mitk::CameraIntrinsics::New(); cameraIntrinsics->FromXMLFile(fileName.toStdString()); this->m_ToFImageGrabber->SetProperty("CameraIntrinsics",mitk::CameraIntrinsicsProperty::New(cameraIntrinsics)); } catch ( std::exception &e ) { MITK_WARN << "Error loading camera intrinsics: " << e.what(); } } ////Reset the status of some GUI-Elements m_Controls->m_DeviceList->setEnabled(false); //Deactivating the Instance of QmitkServiceListWidget //repaint the widget this->repaint(); } else { QMessageBox::information(this,"Camera connection","No camera selected, please select a range camera"); m_Controls->m_ConnectCameraButton->setChecked(false); } } else if (m_Controls->m_ConnectCameraButton->text()=="Disconnect") { this->m_ToFImageGrabber->StopCamera(); this->m_ToFImageGrabber->DisconnectCamera(); m_Controls->m_ConnectCameraButton->setText("Connect"); m_Controls->m_DeviceList->setEnabled(true); //Reactivating ServiceListWidget this->OnSelectCamera(); // send disconnect signal to the caller functionality emit ToFCameraDisconnected(); } } void QmitkToFConnectionWidget::ConnectCamera() { this->m_Controls->m_ConnectCameraButton->animateClick(); } diff --git a/Modules/ToFUI/Qmitk/QmitkToFConnectionWidgetControls.ui b/Modules/ToFUI/Qmitk/QmitkToFConnectionWidgetControls.ui index 8a3e078f40..6b35d713fc 100644 --- a/Modules/ToFUI/Qmitk/QmitkToFConnectionWidgetControls.ui +++ b/Modules/ToFUI/Qmitk/QmitkToFConnectionWidgetControls.ui @@ -1,153 +1,175 @@ QmitkToFConnectionWidgetControls2 0 0 579 - 307 + 229 0 0 QmitkToFConnection + + + + + + + + + 0 0 0 100 16777215 100 false 0 0 200 80 16777215 80 10 Connect to camera Connect :/images/powerRed.png :/images/powerGreen.png:/images/powerRed.png 30 30 true 11 ToF camera connection - - - - - + + + + Qt::Vertical + + + + 20 + 40 + + + QmitkToFPMDParameterWidget QWidget
QmitkToFPMDParameterWidget.h
1
QmitkToFMESAParameterWidget QWidget
QmitkToFMESAParameterWidget.h
1
QmitkKinectParameterWidget QWidget
QmitkKinectParameterWidget.h
1
QmitkServiceListWidget QWidget
QmitkServiceListWidget.h
1
+ + QmitkStructureSensorParameterWidget + QWidget +
QmitkStructureSensorParameterWidget.h
+ 1 +
diff --git a/Modules/ToFUI/files.cmake b/Modules/ToFUI/files.cmake index e07564fc5e..419506ffa0 100644 --- a/Modules/ToFUI/files.cmake +++ b/Modules/ToFUI/files.cmake @@ -1,39 +1,42 @@ SET(CPP_FILES Qmitk/QmitkKinectParameterWidget.cpp + Qmitk/QmitkStructureSensorParameterWidget.cpp Qmitk/QmitkToFConnectionWidget.cpp Qmitk/QmitkToFPointSetWidget.cpp Qmitk/QmitkToFRecorderWidget.cpp Qmitk/QmitkToFVisualisationSettingsWidget.cpp Qmitk/QmitkToFCompositeFilterWidget.cpp Qmitk/QmitkToFPMDParameterWidget.cpp Qmitk/QmitkToFMESAParameterWidget.cpp Qmitk/QmitkToFSurfaceGenerationWidget.cpp ) SET(UI_FILES Qmitk/QmitkKinectParameterWidgetControls.ui + Qmitk/QmitkStructureSensorParameterWidgetControls.ui Qmitk/QmitkToFConnectionWidgetControls.ui Qmitk/QmitkToFPointSetWidgetControls.ui Qmitk/QmitkToFRecorderWidgetControls.ui Qmitk/QmitkToFVisualisationSettingsWidgetControls.ui Qmitk/QmitkToFCompositeFilterWidgetControls.ui Qmitk/QmitkToFPMDParameterWidgetControls.ui Qmitk/QmitkToFMESAParameterWidgetControls.ui Qmitk/QmitkToFSurfaceGenerationWidgetControls.ui ) SET(MOC_H_FILES Qmitk/QmitkKinectParameterWidget.h + Qmitk/QmitkStructureSensorParameterWidget.h Qmitk/QmitkToFConnectionWidget.h Qmitk/QmitkToFPointSetWidget.h Qmitk/QmitkToFRecorderWidget.h Qmitk/QmitkToFVisualisationSettingsWidget.h Qmitk/QmitkToFCompositeFilterWidget.h Qmitk/QmitkToFPMDParameterWidget.h Qmitk/QmitkToFMESAParameterWidget.h Qmitk/QmitkToFSurfaceGenerationWidget.h ) # uncomment the following line if you want to use Qt resources set(QRC_FILES resources/QmitkToFUtilWidget.qrc )