diff --git a/Modules/PhotoacousticsLib/include/mitkPASpectralUnmixingFilter.h b/Modules/PhotoacousticsLib/include/mitkPASpectralUnmixingFilter.h index 74f87d3499..95b9c3f905 100644 --- a/Modules/PhotoacousticsLib/include/mitkPASpectralUnmixingFilter.h +++ b/Modules/PhotoacousticsLib/include/mitkPASpectralUnmixingFilter.h @@ -1,56 +1,57 @@ /*=================================================================== 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 MITKPHOTOACOUSTICSPECTRALUNMIXINGFILTER_H #define MITKPHOTOACOUSTICSPECTRALUNMIXINGFILTER_H #include "mitkImageToImageFilter.h" //Includes for smart pointer usage #include "mitkCommon.h" #include "itkLightObject.h" #include namespace mitk { namespace pa { class MITKPHOTOACOUSTICSLIB_EXPORT SpectralUnmixingFilter : public mitk::ImageToImageFilter { public: mitkClassMacro(SpectralUnmixingFilter, mitk::ImageToImageFilter) itkFactorylessNewMacro(Self) //Contains all (so far) possible chromophores enum ChromophoreType { OXYGENATED, DEOXYGENATED }; void AddWavelength(int wavelength); + void Test(); + std::vector m_Wavelengths; + int size; - protected: SpectralUnmixingFilter(); virtual ~SpectralUnmixingFilter(); private: - std::vector m_Wavelengths; }; } } #endif // MITKPHOTOACOUSTICSPECTRALUNMIXINGFILTER_H diff --git a/Modules/PhotoacousticsLib/src/SUFilter/mitkPASpectralUnmixingFilter.cpp b/Modules/PhotoacousticsLib/src/SUFilter/mitkPASpectralUnmixingFilter.cpp index 20bd001a7e..ee9249bf9f 100644 --- a/Modules/PhotoacousticsLib/src/SUFilter/mitkPASpectralUnmixingFilter.cpp +++ b/Modules/PhotoacousticsLib/src/SUFilter/mitkPASpectralUnmixingFilter.cpp @@ -1,69 +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 "mitkPASpectralUnmixingFilter.h" #include #include mitk::pa::SpectralUnmixingFilter::SpectralUnmixingFilter() { - } mitk::pa::SpectralUnmixingFilter::~SpectralUnmixingFilter() { } +void mitk::pa::SpectralUnmixingFilter::Test() +{ + MITK_INFO << "Test"; +} + void mitk::pa::SpectralUnmixingFilter::AddWavelength(int wavelength) { - MITK_INFO << "ADD WAVELENGTH..."; + + //MITK_INFO << "m_w" << m_Wavelengths[size]; + + /*if (m_Wavelengths.empty()) + { + size = 0; + }*/ + //MITK_INFO << "size after if empty: " << size; + + + //MITK_INFO << "ADD WAVELENGTH..."; + + + MITK_INFO << "begin size: " << size; m_Wavelengths.push_back(wavelength); + MITK_INFO << "inhalt vector size: " << m_Wavelengths[size]; + MITK_INFO << "inhalt vector 0: " << m_Wavelengths[0]; + MITK_INFO << "inhalt vector 10: " << m_Wavelengths[10]; + + + int foo = size; + size = foo + 1; + MITK_INFO << "end size: " << size; + } + //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // VERWORFENES ZEUG: /* void mitk::pa::SpectralUnmixingFilter::GetInputPictures() { MITK_INFO << "GET INPUT PICTURES..."; unsigned int numberOfInputs = GetNumberOfIndexedInputs(); unsigned int numberOfOutputs = GetNumberOfIndexedOutputs(); MITK_INFO << "Inputs: " << numberOfInputs << " Outputs: " << numberOfOutputs; if (m_Wavelengths.empty() || m_Wavelengths.size() != numberOfInputs || numberOfInputs < m_Chromophores.size()) { std::string invalidWavelengthError = "Not enough wavelengths given for calculation."; MITK_ERROR << invalidWavelengthError; mitkThrow() << invalidWavelengthError; } MITK_INFO << "LOADING...[DONE]"; } void mitk::pa::SpectralUnmixingFilter::AddChromophore(int chromophore) { MITK_INFO << "ADD CHROMOPHORE..."; m_Chromophores.push_back(chromophore); } Probably easier to implement in the Plugin like: if (slot x then do algorithm x) void mitk::pa::SpectralUnmixingFilter::ChooseAlgorithm(int algorithm) { MITK_INFO << "CHOOSE ALGORITHM..."; m_Chromophores.push_back(algorithm); }*/ 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 6e3203ddc2..975f612306 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,142 +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. ===================================================================*/ // Blueberry #include #include // Qmitk #include "SpectralUnmixing.h" // Qt #include // mitk image #include -// Perform Spectral Unmixing +// to 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 "; + message << "PERFORMING SPECTRAL UNMIXING (SOON)"; if (node->GetName(name)) { // a property called "name" was found for this DataNode message << "'" << name << "'"; } message << "."; MITK_INFO << message.str(); // actually do something here... // Checking which chromophores wanted for SU if none throw exeption! + numberofChromophores = 0; DeOxbool = m_Controls.checkBoxDeOx->isChecked(); Oxbool = m_Controls.checkBoxOx->isChecked(); if (DeOxbool || Oxbool == true) { MITK_INFO << "CHOSEN CHROMOPHORES:"; } if (Oxbool == true) { + numberofChromophores += 1; MITK_INFO << "- Oxyhemoglobin"; } if (DeOxbool == true) { + numberofChromophores += 1; MITK_INFO << "- Deoxygenated hemoglobin"; } - if (DeOxbool == false && Oxbool == false) + if (numberofChromophores == 0) { mitkThrow() << "PRESS 'IGNORE' AND CHOOSE A CHROMOPHORE!"; } // to do: number of wavelengths has to be larger then checked chromophores ;) + //TEST STUFF: + auto m_SpectralUnmixingFilter = mitk::pa::SpectralUnmixingFilter::New(); + MITK_INFO << "size"<< m_SpectralUnmixingFilter->size; + + //MITK_INFO << "size" << mitk::pa::SpectralUnmixingFilter::size; + //MITK_INFO << "m_W" << mitk::pa::SpectralUnmixingFilter::m_Wavelengths; + //MITK_INFO << ".size" << mitk::pa::SpectralUnmixingFilter::m_Wavelengths.size; + + } } } 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 f670967372..9bd923b52c 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,70 +1,71 @@ /*=================================================================== 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; + unsigned int numberofChromophores; Ui::SpectralUnmixingControls m_Controls; }; #endif // SpectralUnmixing_h