diff --git a/CMake/BuildConfigurations/Default.cmake b/CMake/BuildConfigurations/Default.cmake index 4faffa7f12..700e7efd48 100644 --- a/CMake/BuildConfigurations/Default.cmake +++ b/CMake/BuildConfigurations/Default.cmake @@ -1,23 +1,24 @@ set(MITK_CONFIG_PACKAGES ACVD Qt5 BLUEBERRY ) set(MITK_CONFIG_PLUGINS org.mitk.gui.qt.mitkworkbench.intro org.mitk.gui.qt.datamanager org.mitk.gui.qt.stdmultiwidgeteditor org.mitk.gui.qt.dicombrowser org.mitk.gui.qt.imagenavigator org.mitk.gui.qt.measurementtoolbox org.mitk.gui.qt.properties org.mitk.gui.qt.segmentation org.mitk.gui.qt.volumevisualization org.mitk.planarfigure org.mitk.gui.qt.moviemaker org.mitk.gui.qt.pointsetinteraction org.mitk.gui.qt.remeshing org.mitk.gui.qt.viewnavigator org.mitk.gui.qt.imagecropper + org.mitk.gui.qt.pixelvalue ) diff --git a/Plugins/PluginList.cmake b/Plugins/PluginList.cmake index 733a067492..8b336a0d7e 100644 --- a/Plugins/PluginList.cmake +++ b/Plugins/PluginList.cmake @@ -1,89 +1,89 @@ # 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.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.ext:OFF org.mitk.gui.qt.extapplication:OFF org.mitk.gui.qt.mitkworkbench.intro:OFF org.mitk.gui.qt.common:ON org.mitk.gui.qt.stdmultiwidgeteditor:ON org.mitk.gui.qt.mxnmultiwidgeteditor:OFF org.mitk.gui.qt.cmdlinemodules:OFF org.mitk.gui.qt.chartExample: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.voxelvalue:ON org.mitk.gui.qt.basicimageprocessing:OFF org.mitk.gui.qt.dicombrowser:OFF org.mitk.gui.qt.dicominspector: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.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.deformableclippingplane:OFF org.mitk.gui.qt.aicpregistration:OFF org.mitk.gui.qt.renderwindowmanager:OFF org.mitk.gui.qt.semanticrelations: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.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.ultrasoundtrackingnavigation:OFF org.mitk.gui.qt.classificationsegmentation:OFF org.mitk.gui.qt.overlaymanager:OFF org.mitk.gui.qt.igt.app.hummelprotocolmeasurements: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.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.flowapplication:OFF org.mitk.gui.qt.flow.segmentation:OFF + org.mitk.gui.qt.pixelvalue:ON ) diff --git a/Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkExtDefaultPerspective.cpp b/Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkExtDefaultPerspective.cpp index 0420ddfccc..6e8222469f 100644 --- a/Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkExtDefaultPerspective.cpp +++ b/Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkExtDefaultPerspective.cpp @@ -1,39 +1,41 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "QmitkExtDefaultPerspective.h" #include "berryIViewLayout.h" QmitkExtDefaultPerspective::QmitkExtDefaultPerspective() { } void QmitkExtDefaultPerspective::CreateInitialLayout(berry::IPageLayout::Pointer layout) { QString editorArea = layout->GetEditorArea(); layout->AddView("org.mitk.views.datamanager", berry::IPageLayout::LEFT, 0.21f, editorArea); berry::IViewLayout::Pointer lo = layout->GetViewLayout("org.mitk.views.datamanager"); lo->SetCloseable(false); - layout->AddView("org.mitk.views.imagenavigator", berry::IPageLayout::BOTTOM, 0.5f, "org.mitk.views.datamanager"); + auto folder = layout->CreateFolder("bottomleft", berry::IPageLayout::BOTTOM, 0.72f, "org.mitk.views.datamanager"); + folder->AddView("org.mitk.views.imagenavigator"); + folder->AddView("org.mitk.views.pixelvalue"); layout->AddView("org.mitk.views.viewnavigator", berry::IPageLayout::RIGHT, 0.7f, editorArea); berry::IPlaceholderFolderLayout::Pointer bottomFolder = layout->CreatePlaceholderFolder("bottom", berry::IPageLayout::BOTTOM, 0.7f, editorArea); bottomFolder->AddPlaceholder("org.blueberry.views.logview"); bottomFolder->AddPlaceholder("org.mitk.views.modules"); layout->AddPerspectiveShortcut("org.mitk.mitkworkbench.perspectives.editor"); layout->AddPerspectiveShortcut("org.mitk.mitkworkbench.perspectives.visualization"); } diff --git a/Plugins/org.mitk.gui.qt.pixelvalue/CMakeLists.txt b/Plugins/org.mitk.gui.qt.pixelvalue/CMakeLists.txt new file mode 100644 index 0000000000..02482dcdf5 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.pixelvalue/CMakeLists.txt @@ -0,0 +1,7 @@ +project(org_mitk_gui_qt_pixelvalue) + +mitk_create_plugin( + EXPORT_DIRECTIVE MITK_QT_PIXELVALUE + EXPORTED_INCLUDE_SUFFIXES src + MODULE_DEPENDS MitkQtWidgets +) diff --git a/Plugins/org.mitk.gui.qt.pixelvalue/documentation/UserManual/PixelValueIcon.png b/Plugins/org.mitk.gui.qt.pixelvalue/documentation/UserManual/PixelValueIcon.png new file mode 100644 index 0000000000..563f128049 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.pixelvalue/documentation/UserManual/PixelValueIcon.png differ diff --git a/Plugins/org.mitk.gui.qt.pixelvalue/documentation/UserManual/QmitkPixelValue.dox b/Plugins/org.mitk.gui.qt.pixelvalue/documentation/UserManual/QmitkPixelValue.dox new file mode 100644 index 0000000000..df1a050900 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.pixelvalue/documentation/UserManual/QmitkPixelValue.dox @@ -0,0 +1,7 @@ +/** +\page org_mitk_views_pixelvalue The Pixel Value View + +\imageMacro{PixelValueIcon.png,"Icon of the Pixel Value Plugin.",2.00} + +This is the pixel value plugin. It shows the value of the selected pixel in images. +*/ diff --git a/Plugins/org.mitk.gui.qt.voxelvalue/files.cmake b/Plugins/org.mitk.gui.qt.pixelvalue/files.cmake similarity index 76% rename from Plugins/org.mitk.gui.qt.voxelvalue/files.cmake rename to Plugins/org.mitk.gui.qt.pixelvalue/files.cmake index d946cec8ab..6e6ccf65c4 100644 --- a/Plugins/org.mitk.gui.qt.voxelvalue/files.cmake +++ b/Plugins/org.mitk.gui.qt.pixelvalue/files.cmake @@ -1,30 +1,31 @@ set(INTERNAL_CPP_FILES mitkPluginActivator.cpp - QmitkVoxelValueView.cpp + QmitkPixelValueView.cpp ) set(UI_FILES + src/internal/QmitkPixelValueView.ui ) set(MOC_H_FILES src/internal/mitkPluginActivator.h - src/internal/QmitkVoxelValueView.h + src/internal/QmitkPixelValueView.h ) set(CACHED_RESOURCE_FILES - resources/icon.svg + resources/PixelValueIcon.svg plugin.xml ) set(QRC_FILES ) set(CPP_FILES) foreach(file ${SRC_CPP_FILES}) set(CPP_FILES ${CPP_FILES} src/${file}) endforeach(file ${SRC_CPP_FILES}) foreach(file ${INTERNAL_CPP_FILES}) set(CPP_FILES ${CPP_FILES} src/internal/${file}) endforeach(file ${INTERNAL_CPP_FILES}) diff --git a/Plugins/org.mitk.gui.qt.voxelvalue/manifest_headers.cmake b/Plugins/org.mitk.gui.qt.pixelvalue/manifest_headers.cmake similarity index 70% rename from Plugins/org.mitk.gui.qt.voxelvalue/manifest_headers.cmake rename to Plugins/org.mitk.gui.qt.pixelvalue/manifest_headers.cmake index 53b63f00e5..77bcd70869 100644 --- a/Plugins/org.mitk.gui.qt.voxelvalue/manifest_headers.cmake +++ b/Plugins/org.mitk.gui.qt.pixelvalue/manifest_headers.cmake @@ -1,5 +1,5 @@ -set(Plugin-Name "MITK Voxel Value") -set(Plugin-Version "1.0.0") +set(Plugin-Name "MITK Pixel Value") +set(Plugin-Version "0.1") set(Plugin-Vendor "German Cancer Research Center (DKFZ)") set(Plugin-ContactAddress "https://www.mitk.org") set(Require-Plugin org.mitk.gui.qt.common) diff --git a/Plugins/org.mitk.gui.qt.pixelvalue/plugin.xml b/Plugins/org.mitk.gui.qt.pixelvalue/plugin.xml new file mode 100644 index 0000000000..71019f28df --- /dev/null +++ b/Plugins/org.mitk.gui.qt.pixelvalue/plugin.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/Plugins/org.mitk.gui.qt.pixelvalue/resources/PixelValueIcon.svg b/Plugins/org.mitk.gui.qt.pixelvalue/resources/PixelValueIcon.svg new file mode 100644 index 0000000000..a7def0a8f9 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.pixelvalue/resources/PixelValueIcon.svg @@ -0,0 +1 @@ + diff --git a/Plugins/org.mitk.gui.qt.pixelvalue/src/internal/QmitkPixelValueView.cpp b/Plugins/org.mitk.gui.qt.pixelvalue/src/internal/QmitkPixelValueView.cpp new file mode 100644 index 0000000000..be39b1f658 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.pixelvalue/src/internal/QmitkPixelValueView.cpp @@ -0,0 +1,187 @@ +/*============================================================================ + +The Medical Imaging Interaction Toolkit (MITK) + +Copyright (c) German Cancer Research Center (DKFZ) +All rights reserved. + +Use of this source code is governed by a 3-clause BSD license that can be +found in the LICENSE file. + +============================================================================*/ + +#include "QmitkPixelValueView.h" + +#include +#include +#include +#include +#include + +#include + +const std::string QmitkPixelValueView::VIEW_ID = "org.mitk.views.pixelvalue"; + +QmitkPixelValueView::QmitkPixelValueView(QObject*) + : m_Ui(new Ui::QmitkPixelValueView) +{ +} + +QmitkPixelValueView::~QmitkPixelValueView() +{ +} + +void QmitkPixelValueView::CreateQtPartControl(QWidget* parent) +{ + m_Ui->setupUi(parent); + + this->m_SliceNavigationListener.RenderWindowPartActivated(this->GetRenderWindowPart()); + connect(&m_SliceNavigationListener, &QmitkSliceNavigationListener::SelectedPositionChanged, this, &QmitkPixelValueView::OnSelectedPositionChanged); + connect(&m_SliceNavigationListener, &QmitkSliceNavigationListener::SelectedTimePointChanged, this, &QmitkPixelValueView::OnSelectedTimePointChanged); + + this->Update(); +} + +void QmitkPixelValueView::RenderWindowPartActivated(mitk::IRenderWindowPart* renderWindowPart) +{ + this->m_SliceNavigationListener.RenderWindowPartActivated(renderWindowPart); +} + +void QmitkPixelValueView::RenderWindowPartDeactivated(mitk::IRenderWindowPart* renderWindowPart) +{ + this->m_SliceNavigationListener.RenderWindowPartDeactivated(renderWindowPart); +} + +void QmitkPixelValueView::OnSelectedPositionChanged(const mitk::Point3D&) +{ + this->Update(); +} + +void QmitkPixelValueView::OnSelectedTimePointChanged(const mitk::TimePointType&) +{ + this->Update(); +} + +void QmitkPixelValueView::NodeChanged(const mitk::DataNode*) +{ + this->Update(); +} + +void QmitkPixelValueView::Update() +{ + const auto position = m_SliceNavigationListener.GetCurrentSelectedPosition(); + const auto timePoint = m_SliceNavigationListener.GetCurrentSelectedTimePoint(); + + auto isImageData = mitk::TNodePredicateDataType::New(); + auto nodes = GetDataStorage()->GetSubset(isImageData); + + if (nodes.IsNull()) + { + this->Clear(); + return; + } + + mitk::Image::Pointer image; + mitk::DataNode::Pointer topParentNode; + + int component = 0; + + auto node = mitk::FindTopmostVisibleNode(nodes, position, timePoint, nullptr); + + if (node.IsNull()) + { + this->Clear(); + return; + } + + bool isBinary = false; + node->GetBoolProperty("binary", isBinary); + + if (isBinary) + { + auto parentNodes = GetDataStorage()->GetSources(node, nullptr, true); + + if (!parentNodes->empty()) + topParentNode = FindTopmostVisibleNode(nodes, position, timePoint, nullptr); + + if (topParentNode.IsNotNull()) + { + image = dynamic_cast(topParentNode->GetData()); + topParentNode->GetIntProperty("Image.Displayed Component", component); + } + else + { + image = dynamic_cast(node->GetData()); + node->GetIntProperty("Image.Displayed Component", component); + } + } + else + { + image = dynamic_cast(node->GetData()); + node->GetIntProperty("Image.Displayed Component", component); + } + + if (image.IsNotNull()) + { + m_Ui->imageNameLineEdit->setText(QString::fromStdString(node->GetName())); + + itk::Index<3> index; + image->GetGeometry()->WorldToIndex(position, index); + + auto pixelType = image->GetChannelDescriptor().GetPixelType().GetPixelType(); + + if (pixelType == itk::IOPixelEnum::RGB || pixelType == itk::IOPixelEnum::RGBA) + { + m_Ui->pixelValueLineEdit->setText(QString::fromStdString(mitk::ConvertCompositePixelValueToString(image, index))); + return; + } + + if (pixelType == itk::IOPixelEnum::DIFFUSIONTENSOR3D || pixelType == itk::IOPixelEnum::SYMMETRICSECONDRANKTENSOR) + { + m_Ui->pixelValueLineEdit->setText(QStringLiteral("See ODF Details view.")); + return; + } + + mitk::ScalarType pixelValue = 0.0; + + mitkPixelTypeMultiplex5( + mitk::FastSinglePixelAccess, + image->GetChannelDescriptor().GetPixelType(), + image, + image->GetVolumeData(image->GetTimeGeometry()->TimePointToTimeStep(timePoint)), + index, + pixelValue, + component); + + std::ostringstream stream; + stream.imbue(std::locale::classic()); + stream.precision(2); + + if (fabs(pixelValue) > 1000000 || fabs(pixelValue) < 0.01) + { + stream << std::scientific; + } + else + { + stream << std::fixed; + } + + stream << pixelValue; + + m_Ui->pixelValueLineEdit->setText(QString::fromStdString(stream.str())); + } + else + { + this->Clear(); + } +} + +void QmitkPixelValueView::Clear() +{ + m_Ui->imageNameLineEdit->clear(); + m_Ui->pixelValueLineEdit->clear(); +} + +void QmitkPixelValueView::SetFocus() +{ +} diff --git a/Plugins/org.mitk.gui.qt.voxelvalue/src/internal/QmitkVoxelValueView.h b/Plugins/org.mitk.gui.qt.pixelvalue/src/internal/QmitkPixelValueView.h similarity index 58% rename from Plugins/org.mitk.gui.qt.voxelvalue/src/internal/QmitkVoxelValueView.h rename to Plugins/org.mitk.gui.qt.pixelvalue/src/internal/QmitkPixelValueView.h index 97c0fab670..0066df315e 100644 --- a/Plugins/org.mitk.gui.qt.voxelvalue/src/internal/QmitkVoxelValueView.h +++ b/Plugins/org.mitk.gui.qt.pixelvalue/src/internal/QmitkPixelValueView.h @@ -1,54 +1,56 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ -#ifndef QmitkVoxelValueView_h -#define QmitkVoxelValueView_h +#ifndef QmitkPixelValueView_h +#define QmitkPixelValueView_h #include #include #include -#include -#include -#include - -class QmitkVoxelValueView : public QmitkAbstractView, public mitk::IRenderWindowPartListener +namespace Ui { + class QmitkPixelValueView; +} +class QmitkPixelValueView : public QmitkAbstractView, public mitk::IRenderWindowPartListener +{ Q_OBJECT public: static const std::string VIEW_ID; - QmitkVoxelValueView(QObject *parent = nullptr); + QmitkPixelValueView(QObject* parent = nullptr); - ~QmitkVoxelValueView() override; + ~QmitkPixelValueView() override; - void CreateQtPartControl(QWidget *parent) override; + void CreateQtPartControl(QWidget* parent) override; - void SetFocus() override { }; + void SetFocus() override; -protected Q_SLOTS: - void OnSliceChanged(); - -protected: +private: void RenderWindowPartActivated(mitk::IRenderWindowPart* renderWindowPart) override; void RenderWindowPartDeactivated(mitk::IRenderWindowPart* renderWindowPart) override; -private: - QHBoxLayout* m_Layout; - QLabel* m_Label; - QLineEdit* m_TextWidget; + void OnSelectedPositionChanged(const mitk::Point3D& position); + void OnSelectedTimePointChanged(const mitk::TimePointType& timePoint); + + void NodeChanged(const mitk::DataNode* node) override; + + void Clear(); + void Update(); + QmitkSliceNavigationListener m_SliceNavigationListener; + Ui::QmitkPixelValueView* m_Ui; }; -#endif // QmitkVoxelValueView_h +#endif diff --git a/Plugins/org.mitk.gui.qt.pixelvalue/src/internal/QmitkPixelValueView.ui b/Plugins/org.mitk.gui.qt.pixelvalue/src/internal/QmitkPixelValueView.ui new file mode 100644 index 0000000000..eb3ab2723a --- /dev/null +++ b/Plugins/org.mitk.gui.qt.pixelvalue/src/internal/QmitkPixelValueView.ui @@ -0,0 +1,59 @@ + + + QmitkPixelValueView + + + + 0 + 0 + 400 + 300 + + + + Pixel Value + + + + + + + + Image name + + + Qt::PlainText + + + + + + + true + + + + + + + Pixel value + + + Qt::PlainText + + + + + + + true + + + + + + + + + + diff --git a/Plugins/org.mitk.gui.qt.voxelvalue/src/internal/mitkPluginActivator.cpp b/Plugins/org.mitk.gui.qt.pixelvalue/src/internal/mitkPluginActivator.cpp similarity index 85% rename from Plugins/org.mitk.gui.qt.voxelvalue/src/internal/mitkPluginActivator.cpp rename to Plugins/org.mitk.gui.qt.pixelvalue/src/internal/mitkPluginActivator.cpp index 21f4f19664..e1ff080825 100644 --- a/Plugins/org.mitk.gui.qt.voxelvalue/src/internal/mitkPluginActivator.cpp +++ b/Plugins/org.mitk.gui.qt.pixelvalue/src/internal/mitkPluginActivator.cpp @@ -1,23 +1,23 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "mitkPluginActivator.h" -#include "QmitkVoxelValueView.h" +#include "QmitkPixelValueView.h" void mitk::mitkPluginActivator::start(ctkPluginContext* context) { - BERRY_REGISTER_EXTENSION_CLASS(QmitkVoxelValueView, context) + BERRY_REGISTER_EXTENSION_CLASS(QmitkPixelValueView, context) } void mitk::mitkPluginActivator::stop(ctkPluginContext*) { } diff --git a/Plugins/org.mitk.gui.qt.voxelvalue/src/internal/mitkPluginActivator.h b/Plugins/org.mitk.gui.qt.pixelvalue/src/internal/mitkPluginActivator.h similarity index 100% rename from Plugins/org.mitk.gui.qt.voxelvalue/src/internal/mitkPluginActivator.h rename to Plugins/org.mitk.gui.qt.pixelvalue/src/internal/mitkPluginActivator.h diff --git a/Plugins/org.mitk.gui.qt.voxelvalue/CMakeLists.txt b/Plugins/org.mitk.gui.qt.voxelvalue/CMakeLists.txt deleted file mode 100644 index 1515886837..0000000000 --- a/Plugins/org.mitk.gui.qt.voxelvalue/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -project(org_mitk_gui_qt_voxelvalue) - -mitk_create_plugin( - EXPORT_DIRECTIVE MITK_QT_VOXELVALUE - EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDS MitkQtWidgetsExt -) - diff --git a/Plugins/org.mitk.gui.qt.voxelvalue/documentation/doxygen/modules.dox b/Plugins/org.mitk.gui.qt.voxelvalue/documentation/doxygen/modules.dox deleted file mode 100644 index 08af3f3c61..0000000000 --- a/Plugins/org.mitk.gui.qt.voxelvalue/documentation/doxygen/modules.dox +++ /dev/null @@ -1,16 +0,0 @@ -/** - \defgroup org_mitk_gui_qt_voxelvalue org.mitk.gui.qt.voxelvalue - \ingroup MITKPlugins - - \brief This is the voxel value plugin. It shows the value of the selected voxel in images. - -*/ - -/** - \defgroup org_mitk_gui_qt_voxelvalue_internal Internal - \ingroup org_mitk_gui_qt_voxelvalue - - \brief This subcategory includes the internal classes of the org.mitk.gui.qt.voxelvalue plugin. Other - plugins must not rely on these classes. They contain implementation details and their interface - may change at any time. We mean it. -*/ \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.voxelvalue/plugin.xml b/Plugins/org.mitk.gui.qt.voxelvalue/plugin.xml deleted file mode 100644 index 237518af0a..0000000000 --- a/Plugins/org.mitk.gui.qt.voxelvalue/plugin.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - Crop images to a given size - - - - - diff --git a/Plugins/org.mitk.gui.qt.voxelvalue/resources/icon.svg b/Plugins/org.mitk.gui.qt.voxelvalue/resources/icon.svg deleted file mode 100644 index 95e7a66fc2..0000000000 --- a/Plugins/org.mitk.gui.qt.voxelvalue/resources/icon.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.voxelvalue/src/internal/QmitkVoxelValueView.cpp b/Plugins/org.mitk.gui.qt.voxelvalue/src/internal/QmitkVoxelValueView.cpp deleted file mode 100644 index d47cbedb25..0000000000 --- a/Plugins/org.mitk.gui.qt.voxelvalue/src/internal/QmitkVoxelValueView.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/*============================================================================ - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center (DKFZ) -All rights reserved. - -Use of this source code is governed by a 3-clause BSD license that can be -found in the LICENSE file. - -============================================================================*/ - -#include "QmitkVoxelValueView.h" - -#include -#include -#include -#include -#include - -#include - - -const std::string QmitkVoxelValueView::VIEW_ID = "org.mitk.views.qmitkvoxelvalue"; - -QmitkVoxelValueView::QmitkVoxelValueView(QObject*) - : m_Layout(nullptr) - , m_Label(nullptr) - , m_TextWidget(nullptr) -{ -} - -QmitkVoxelValueView::~QmitkVoxelValueView() -{ -} - -void QmitkVoxelValueView::CreateQtPartControl(QWidget *parent) -{ - m_Layout = new QHBoxLayout(parent); - m_Layout->setMargin(0); - - m_Label = new QLabel(parent); - m_Label->setText("Pixel value:"); - m_Layout->addWidget(m_Label); - - m_TextWidget = new QLineEdit(parent); - m_TextWidget->setReadOnly(true); - m_Layout->addWidget(m_TextWidget); - - this->m_SliceNavigationListener.RenderWindowPartActivated(this->GetRenderWindowPart()); - connect(&m_SliceNavigationListener, &QmitkSliceNavigationListener::SliceChanged, this, &QmitkVoxelValueView::OnSliceChanged); -} - -void QmitkVoxelValueView::RenderWindowPartActivated(mitk::IRenderWindowPart* renderWindowPart) -{ - this->m_SliceNavigationListener.RenderWindowPartActivated(renderWindowPart); -} - -void QmitkVoxelValueView::RenderWindowPartDeactivated(mitk::IRenderWindowPart* renderWindowPart) -{ - this->m_SliceNavigationListener.RenderWindowPartDeactivated(renderWindowPart); -} - -void QmitkVoxelValueView::OnSliceChanged() -{ - const auto position = m_SliceNavigationListener.GetCurrentSelectedPosition(); - const auto timePoint = m_SliceNavigationListener.GetCurrentSelectedTimePoint(); - - mitk::TNodePredicateDataType::Pointer isImageData = mitk::TNodePredicateDataType::New(); - mitk::DataStorage::SetOfObjects::ConstPointer nodes = GetDataStorage()->GetSubset(isImageData).GetPointer(); - if (nodes.IsNull()) - { - return; - } - - mitk::Image::Pointer image3D; - mitk::DataNode::Pointer node; - mitk::DataNode::Pointer topSourceNode; - - int component = 0; - - node = mitk::FindTopmostVisibleNode(nodes, position, timePoint, nullptr); - if (node.IsNull()) - { - return; - } - - bool isBinary(false); - node->GetBoolProperty("binary", isBinary); - if (isBinary) - { - mitk::DataStorage::SetOfObjects::ConstPointer sourcenodes = GetDataStorage()->GetSources(node, nullptr, true); - if (!sourcenodes->empty()) - { - topSourceNode = FindTopmostVisibleNode(nodes, position, timePoint, nullptr); - } - if (topSourceNode.IsNotNull()) - { - image3D = dynamic_cast(topSourceNode->GetData()); - topSourceNode->GetIntProperty("Image.Displayed Component", component); - } - else - { - image3D = dynamic_cast(node->GetData()); - node->GetIntProperty("Image.Displayed Component", component); - } - } - else - { - image3D = dynamic_cast(node->GetData()); - node->GetIntProperty("Image.Displayed Component", component); - } - - // get the position and pixel value from the image and build up voxel view text - std::string voxelText = ""; - if (image3D.IsNotNull()) - { - itk::Index<3> p; - image3D->GetGeometry()->WorldToIndex(position, p); - - auto pixelType = image3D->GetChannelDescriptor().GetPixelType().GetPixelType(); - if (pixelType == itk::IOPixelEnum::RGB || pixelType == itk::IOPixelEnum::RGBA) - { - m_Label->setText("Pixel RGB(A) value: "); - voxelText.append(ConvertCompositePixelValueToString(image3D, p)); - } - else if (pixelType == itk::IOPixelEnum::DIFFUSIONTENSOR3D || pixelType == itk::IOPixelEnum::SYMMETRICSECONDRANKTENSOR) - { - m_Label->setText("See ODF Details view. "); - } - else - { - m_Label->setText("Pixel value: "); - mitk::ScalarType pixelValue; - mitkPixelTypeMultiplex5( - mitk::FastSinglePixelAccess, - image3D->GetChannelDescriptor().GetPixelType(), - image3D, - image3D->GetVolumeData(image3D->GetTimeGeometry()->TimePointToTimeStep(timePoint)), - p, - pixelValue, - component); - - std::ostringstream stream; - stream.imbue(std::locale::classic()); - stream.precision(2); - - if (fabs(pixelValue) > 1000000 || fabs(pixelValue) < 0.01) - { - stream << std::scientific; - } - else - { - stream << std::fixed; - } - - stream << pixelValue; - - voxelText = stream.str(); - } - - m_TextWidget->setText(QString(voxelText.c_str())); - } - else - { - m_TextWidget->setText(QString("")); - } -}