diff --git a/Plugins/PluginList.cmake b/Plugins/PluginList.cmake index 1646c26d7f..6ba26e9c2d 100644 --- a/Plugins/PluginList.cmake +++ b/Plugins/PluginList.cmake @@ -1,113 +1,114 @@ # Plug-ins must be ordered according to their dependencies set(MITK_PLUGINS org.blueberry.core.runtime:ON org.blueberry.core.expressions:OFF org.blueberry.core.commands:OFF org.blueberry.core.jobs:OFF org.blueberry.ui.qt:OFF org.blueberry.ui.qt.help:ON org.blueberry.ui.qt.log:ON org.blueberry.ui.qt.objectinspector:OFF #org.blueberry.test:ON #org.blueberry.uitest:ON #Testing/org.blueberry.core.runtime.tests:ON #Testing/org.blueberry.osgi.tests:ON org.mitk.core.services:ON org.mitk.gui.common:ON org.mitk.planarfigure:ON org.mitk.core.ext:OFF org.mitk.core.jobs:OFF org.mitk.gui.qt.application:ON org.mitk.gui.qt.coreapplication:OFF org.mitk.gui.qt.ext:OFF org.mitk.gui.qt.extapplication:OFF org.mitk.gui.qt.common:ON org.mitk.gui.qt.stdmultiwidgeteditor:ON org.mitk.gui.qt.common.legacy:OFF org.mitk.gui.qt.cmdlinemodules:OFF org.mitk.gui.qt.diffusionimagingapp:OFF org.mitk.gui.qt.datamanager:ON org.mitk.gui.qt.datamanagerlight:OFF org.mitk.gui.qt.datastorageviewertest:OFF org.mitk.gui.qt.properties:ON org.mitk.gui.qt.basicimageprocessing:OFF org.mitk.gui.qt.dicom:OFF org.mitk.gui.qt.dicominspector:OFF org.mitk.gui.qt.diffusionimaging:OFF org.mitk.gui.qt.diffusionimaging.connectomics:OFF org.mitk.gui.qt.diffusionimaging.denoising:OFF org.mitk.gui.qt.diffusionimaging.fiberfox:OFF org.mitk.gui.qt.diffusionimaging.fiberprocessing:OFF org.mitk.gui.qt.diffusionimaging.ivim:OFF org.mitk.gui.qt.diffusionimaging.odfpeaks:OFF org.mitk.gui.qt.diffusionimaging.partialvolume:OFF org.mitk.gui.qt.diffusionimaging.preprocessing:OFF org.mitk.gui.qt.diffusionimaging.reconstruction:OFF org.mitk.gui.qt.diffusionimaging.registration:OFF org.mitk.gui.qt.diffusionimaging.tractography:OFF org.mitk.gui.qt.diffusionimaging.python:OFF org.mitk.gui.qt.dosevisualization:OFF org.mitk.gui.qt.geometrytools:OFF org.mitk.gui.qt.igtexamples:OFF org.mitk.gui.qt.igttracking:OFF org.mitk.gui.qt.lasercontrol:OFF org.mitk.gui.qt.openigtlink:OFF org.mitk.gui.qt.imagecropper:OFF org.mitk.gui.qt.imagenavigator:ON org.mitk.gui.qt.viewnavigator:OFF org.mitk.gui.qt.materialeditor:OFF org.mitk.gui.qt.measurementtoolbox:OFF org.mitk.gui.qt.moviemaker:OFF org.mitk.gui.qt.pointsetinteraction:OFF org.mitk.gui.qt.pointsetinteractionmultispectrum:OFF org.mitk.gui.qt.python:OFF org.mitk.gui.qt.remeshing:OFF org.mitk.gui.qt.segmentation:OFF org.mitk.gui.qt.aicpregistration:OFF org.mitk.gui.qt.renderwindowmanager:OFF org.mitk.gui.qt.toftutorial:OFF org.mitk.gui.qt.tofutil:OFF org.mitk.gui.qt.tubegraph:OFF org.mitk.gui.qt.ugvisualization:OFF org.mitk.gui.qt.photoacoustics.pausviewer:OFF org.mitk.gui.qt.photoacoustics.pausmotioncompensation:OFF org.mitk.gui.qt.photoacoustics.imageprocessing:OFF org.mitk.gui.qt.photoacoustics.simulation:OFF org.mitk.gui.qt.photoacoustics.spectralunmixing:OFF org.mitk.gui.qt.ultrasound:OFF org.mitk.gui.qt.volumevisualization:OFF org.mitk.gui.qt.eventrecorder:OFF org.mitk.gui.qt.xnat:OFF org.mitk.gui.qt.igt.app.echotrack:OFF org.mitk.gui.qt.spectrocamrecorder:OFF org.mitk.gui.qt.classificationsegmentation:OFF org.mitk.gui.qt.overlaymanager:OFF org.mitk.gui.qt.igt.app.hummelprotocolmeasurements:OFF org.mitk.gui.qt.multilabelsegmentation:OFF org.mitk.matchpoint.core.helper:OFF org.mitk.gui.qt.matchpoint.algorithm.browser:OFF org.mitk.gui.qt.matchpoint.algorithm.control:OFF org.mitk.gui.qt.matchpoint.algorithm.batch:OFF org.mitk.gui.qt.matchpoint.mapper:OFF org.mitk.gui.qt.matchpoint.framereg:OFF org.mitk.gui.qt.matchpoint.visualizer:OFF org.mitk.gui.qt.matchpoint.evaluator:OFF org.mitk.gui.qt.matchpoint.manipulator:OFF org.mitk.gui.qt.preprocessing.resampling:OFF org.mitk.gui.qt.radiomics:OFF org.mitk.gui.qt.cest:OFF org.mitk.gui.qt.fit.demo:OFF org.mitk.gui.qt.fit.inspector:OFF org.mitk.gui.qt.fit.genericfitting:OFF org.mitk.gui.qt.pharmacokinetics.mri:OFF org.mitk.gui.qt.pharmacokinetics.pet:OFF org.mitk.gui.qt.pharmacokinetics.simulation:OFF org.mitk.gui.qt.pharmacokinetics.curvedescriptor:OFF org.mitk.gui.qt.pharmacokinetics.concentration.mri:OFF + org.mitk.gui.qt.exampleplugin:OFF ) diff --git a/Plugins/org.mitk.gui.qt.exampleplugin/src/internal/ExampleView.cpp b/Plugins/org.mitk.gui.qt.exampleplugin/src/internal/ExampleView.cpp index d07989e916..70290874dd 100644 --- a/Plugins/org.mitk.gui.qt.exampleplugin/src/internal/ExampleView.cpp +++ b/Plugins/org.mitk.gui.qt.exampleplugin/src/internal/ExampleView.cpp @@ -1,102 +1,162 @@ /*=================================================================== 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 <-research // Blueberry #include #include // Qmitk #include "ExampleView.h" // Qt #include +#include +#include +#include + + // mitk image #include +#include +#include +#include +#include + const std::string ExampleView::VIEW_ID = "org.mitk.views.exampleview"; void ExampleView::SetFocus() { m_Controls.buttonPerformImageProcessing->setFocus(); } void ExampleView::CreateQtPartControl(QWidget *parent) { // create GUI widgets from the Qt Designer's .ui file m_Controls.setupUi(parent); - connect(m_Controls.buttonPerformImageProcessing, &QPushButton::clicked, this, &ExampleView::DoImageProcessing); + connect(m_Controls.buttonPerformImageProcessing, &QPushButton::clicked, this, &ExampleView::DoImageStatistics); + connect(m_Controls.buttonGenerate, &QPushButton::clicked, this, &ExampleView::DoPixelMasking); } void ExampleView::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 ExampleView::DoImageProcessing() +void ExampleView::DoImageStatistics() { QList nodes = this->GetDataManagerSelection(); if (nodes.empty()) return; mitk::DataNode *node = nodes.front(); - if (!node) + if (node == nullptr) { // Nothing selected. Inform the user and return - QMessageBox::information(nullptr, "Template", "Please load and select an image before starting image processing."); + QMessageBox::information(nullptr, "Warning", "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... + //get max + + //get min + + //get average + + //get dev + } } } + +void ExampleView::DoPixelMasking() +{ + this->ProcessImage(); +} + +void ExampleView::ProcessImage() +{ + // check for valid node selected + QList nodes = this->GetDataManagerSelection(); + + if (nodes.empty()) + return; + + mitk::DataNode *node = nodes.front(); + + if (node == nullptr) + { + // Nothing selected. Inform the user and return + QMessageBox::information(nullptr, "Warning", "Please load and select an image before starting image processing."); + return; + } + + mitk::BaseData* data = node->GetData(); //get data from node + if (data != nullptr) + { + //Ask for the name of the mask + bool ok = false; + QString name = QInputDialog::getText(QApplication::activeWindow() + , tr("Add mask..."), tr("Enter name for the new mask"), QLineEdit::Normal, tr("mask"), &ok); + if (!ok || name.isEmpty()) + return; + + //Create a new empty pointset + // + mitk::Image::Pointer mask = mitk::Image::New(); + // + // Create a new data tree node + // + mitk::DataNode::Pointer maskNode = mitk::DataNode::New(); + // + // fill the data tree node with the appropriate information + // + maskNode->SetData(mask); + maskNode->SetProperty("name", mitk::StringProperty::New(name.toStdString())); + maskNode->SetProperty("opacity", mitk::FloatProperty::New(1)); + maskNode->SetColor(1.0, 1.0, 0.0); + // + // add the node to the ds + // + this->GetDataStorage()->Add(maskNode); + } +} \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.exampleplugin/src/internal/ExampleView.h b/Plugins/org.mitk.gui.qt.exampleplugin/src/internal/ExampleView.h index adf8e39f67..7a5a8ebca6 100644 --- a/Plugins/org.mitk.gui.qt.exampleplugin/src/internal/ExampleView.h +++ b/Plugins/org.mitk.gui.qt.exampleplugin/src/internal/ExampleView.h @@ -1,59 +1,61 @@ /*=================================================================== 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 ExampleView_h #define ExampleView_h #include #include #include "ui_ExampleViewControls.h" /** \brief ExampleView \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 ExampleView : 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; 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(); + void DoImageStatistics(); + void DoPixelMasking(); + void ProcessImage(); Ui::ExampleViewControls m_Controls; }; #endif // ExampleView_h diff --git a/Plugins/org.mitk.gui.qt.exampleplugin/src/internal/ExampleViewControls.ui b/Plugins/org.mitk.gui.qt.exampleplugin/src/internal/ExampleViewControls.ui index d6971304e4..b6e5acd889 100644 --- a/Plugins/org.mitk.gui.qt.exampleplugin/src/internal/ExampleViewControls.ui +++ b/Plugins/org.mitk.gui.qt.exampleplugin/src/internal/ExampleViewControls.ui @@ -1,84 +1,124 @@ ExampleViewControls 0 0 222 - 161 + 284 0 0 QmitkTemplate + + + + Qt::RightToLeft + + + + 1 + + + + + Qt::LeftToRight + + + + + + + Image: + + + + + + QLabel { color: rgb(255, 0, 0) } Please select an image! Do image processing Calculate Statistics: Threshold + + + + Generate + + + Qt::Vertical QSizePolicy::Expanding 20 220 + + + QmitkDataStorageComboBox + QComboBox +
QmitkDataStorageComboBox.h
+
+