diff --git a/Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/src/internal/SpectralUnmixing.cpp b/Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/src/internal/SpectralUnmixing.cpp index 672d6b88bb..6e3203ddc2 100644 --- a/Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/src/internal/SpectralUnmixing.cpp +++ b/Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/src/internal/SpectralUnmixing.cpp @@ -1,123 +1,142 @@ /*=================================================================== 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 // Qmitk #include "SpectralUnmixing.h" // Qt #include // mitk image #include // Perform Spectral Unmixing - #include "mitkPASpectralUnmixingFilter.h" const std::string SpectralUnmixing::VIEW_ID = "org.mitk.views.spectralunmixing"; void SpectralUnmixing::SetFocus() { m_Controls.buttonPerformImageProcessing->setFocus(); } void SpectralUnmixing::CreateQtPartControl(QWidget *parent) { // create GUI widgets from the Qt Designer's .ui file m_Controls.setupUi(parent); connect(m_Controls.buttonPerformImageProcessing, &QPushButton::clicked, this, &SpectralUnmixing::DoImageProcessing); + connect(m_Controls.ButtonAddWavelength, &QPushButton::clicked, this, &SpectralUnmixing::Wavelength); + +} + +void SpectralUnmixing::Wavelength() +{ + auto m_SpectralUnmixingFilter = mitk::pa::SpectralUnmixingFilter::New(); + wavelength = m_Controls.spinBoxAddWavelength->value(); + m_SpectralUnmixingFilter->AddWavelength(wavelength); + MITK_INFO << wavelength << " nm"; } + + + void SpectralUnmixing::OnSelectionChanged(berry::IWorkbenchPart::Pointer /*source*/, const QList &nodes) { // iterate all selected objects, adjust warning visibility foreach (mitk::DataNode::Pointer node, nodes) { if (node.IsNotNull() && dynamic_cast(node->GetData())) { m_Controls.labelWarning->setVisible(false); m_Controls.buttonPerformImageProcessing->setEnabled(true); return; } } m_Controls.labelWarning->setVisible(true); m_Controls.buttonPerformImageProcessing->setEnabled(false); } void SpectralUnmixing::DoImageProcessing() { QList nodes = this->GetDataManagerSelection(); if (nodes.empty()) return; mitk::DataNode *node = nodes.front(); if (!node) { // Nothing selected. Inform the user and return QMessageBox::information(nullptr, "Template", "Please load and select an image before starting image processing."); return; } // here we have a valid mitk::DataNode // a node itself is not very useful, we need its data item (the image) mitk::BaseData *data = node->GetData(); if (data) { // test if this data item is an image or not (could also be a surface or something totally different) mitk::Image *image = dynamic_cast(data); if (image) { std::stringstream message; std::string name; message << "Performing image processing for image "; if (node->GetName(name)) { // a property called "name" was found for this DataNode message << "'" << name << "'"; } message << "."; MITK_INFO << message.str(); // actually do something here... - // Add Wavelength - - auto m_SpectralUnmixingFilter = mitk::pa::SpectralUnmixingFilter::New(); - unsigned int wavelength1 = m_Controls.spinBoxWavelength1->value(); - unsigned int wavelength2 = m_Controls.spinBoxWavelength2->value(); - - unsigned int dimension = 3; - mitk::PixelType TPixel = mitk::MakeScalarPixelType(); + // Checking which chromophores wanted for SU if none throw exeption! + DeOxbool = m_Controls.checkBoxDeOx->isChecked(); + Oxbool = m_Controls.checkBoxOx->isChecked(); + if (DeOxbool || Oxbool == true) + { + MITK_INFO << "CHOSEN CHROMOPHORES:"; + } + if (Oxbool == true) + { + MITK_INFO << "- Oxyhemoglobin"; + } + if (DeOxbool == true) + { + MITK_INFO << "- Deoxygenated hemoglobin"; + } + if (DeOxbool == false && Oxbool == false) + { + mitkThrow() << "PRESS 'IGNORE' AND CHOOSE A CHROMOPHORE!"; + } - MITK_INFO << wavelength1; - m_SpectralUnmixingFilter->AddWavelength(wavelength1); - MITK_INFO << wavelength2; - m_SpectralUnmixingFilter->AddWavelength(wavelength2); - //MITK_INFO << m_SpectralUnmixingFilter; + // to do: number of wavelengths has to be larger then checked chromophores ;) } } } diff --git a/Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/src/internal/SpectralUnmixing.h b/Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/src/internal/SpectralUnmixing.h index b1dd4095d2..f670967372 100644 --- a/Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/src/internal/SpectralUnmixing.h +++ b/Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/src/internal/SpectralUnmixing.h @@ -1,65 +1,70 @@ /*=================================================================== 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 SpectralUnmixing_h #define SpectralUnmixing_h #include #include #include "ui_SpectralUnmixingControls.h" // Perform Spectral Unmixing //include "mitkPASpectralUnmixingFilter.h" //--> include does not work //solution fprr cpp file 'Just right-click on the project -> Configuration Properties -> C/C++ -> General -> Additional Include Directories.' //https://stackoverflow.com/questions/12561048/visual-studio-cannot-include-header-file /** \brief SpectralUnmixing \warning This class is not yet documented. Use "git blame" and ask the author to provide basic documentation. \sa QmitkAbstractView \ingroup ${plugin_target}_internal */ class SpectralUnmixing : 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: static const std::string VIEW_ID; + bool DeOxbool; + bool Oxbool; + protected: virtual void CreateQtPartControl(QWidget *parent) override; virtual void SetFocus() override; /// \brief called by QmitkFunctionality when DataManager's selection has changed virtual void OnSelectionChanged(berry::IWorkbenchPart::Pointer source, const QList &nodes) override; /// \brief Called when the user clicks the GUI button void DoImageProcessing(); + virtual void Wavelength(); + unsigned int wavelength; Ui::SpectralUnmixingControls m_Controls; }; #endif // SpectralUnmixing_h diff --git a/Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/src/internal/SpectralUnmixingControls.ui b/Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/src/internal/SpectralUnmixingControls.ui index a205e5e112..e9200f8e55 100644 --- a/Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/src/internal/SpectralUnmixingControls.ui +++ b/Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/src/internal/SpectralUnmixingControls.ui @@ -1,113 +1,116 @@ SpectralUnmixingControls 0 0 222 - 161 + 399 0 0 QmitkTemplate - - - - - Do image processing - - - Do Something - - - - - - - + + + + + - Wavelength 1 + Oxyhemoglobin + + + true - - - - 500 + + + + Do image processing - - 1500 - - - 666 + + Do Something - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - QLabel { color: rgb(255, 0, 0) } - - - Please select an image! - - - - - - - + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + QLabel { color: rgb(255, 0, 0) } + - Wavelength 2 + Please select an image! - - - - 500 + + + + true - - 1500 + + Deoxygenated hemoglobin + + + true - - 666 + + true + + + false + + + + + + Add Wavelength [nm] + + + + + + + 2000 + + + + +