diff --git a/Modules/ImageStatisticsUI/CMakeLists.txt b/Modules/ImageStatisticsUI/CMakeLists.txt new file mode 100644 index 0000000000..e485f5c3d3 --- /dev/null +++ b/Modules/ImageStatisticsUI/CMakeLists.txt @@ -0,0 +1,5 @@ +MITK_CREATE_MODULE( + INCLUDE_DIRS Qmitk + DEPENDS MitkCore MitkChart + PACKAGE_DEPENDS PRIVATE Qt5|WebEngineWidgets +) \ No newline at end of file diff --git a/Modules/ImageStatisticsUI/Qmitk/QmitkHistogramVisualizationControls.ui b/Modules/ImageStatisticsUI/Qmitk/QmitkHistogramVisualizationControls.ui new file mode 100644 index 0000000000..ac4a41972c --- /dev/null +++ b/Modules/ImageStatisticsUI/Qmitk/QmitkHistogramVisualizationControls.ui @@ -0,0 +1,405 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>QmitkHistogramVisualizationControls</class> + <widget class="QWidget" name="QmitkHistogramVisualizationControls"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>540</width> + <height>460</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>540</width> + <height>460</height> + </size> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <widget class="QGroupBox" name="groupBoxHistogram"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>530</width> + <height>450</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>400</width> + <height>450</height> + </size> + </property> + <property name="title"> + <string/> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QLabel" name="labelHistogramIsInvisibleWarning"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="palette"> + <palette> + <active> + <colorrole role="WindowText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Text"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="ButtonText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </active> + <inactive> + <colorrole role="WindowText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Text"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="ButtonText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </inactive> + <disabled> + <colorrole role="WindowText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>120</red> + <green>120</green> + <blue>120</blue> + </color> + </brush> + </colorrole> + <colorrole role="Text"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>120</red> + <green>120</green> + <blue>120</blue> + </color> + </brush> + </colorrole> + <colorrole role="ButtonText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>120</red> + <green>120</green> + <blue>120</blue> + </color> + </brush> + </colorrole> + </disabled> + </palette> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBoxPlot"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="title"> + <string>Plot</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QRadioButton" name="radioButtonBarchart"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="text"> + <string>Barchart</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="radioButtonLinegraph"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Linegraph</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <widget class="QCheckBox" name="checkBoxShowSubchart"> + <property name="text"> + <string>Show Subchart</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="checkBoxUseDefaultNBins"> + <property name="text"> + <string>Use default #bins</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QFrame" name="FrameBinSize"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <property name="spacing"> + <number>0</number> + </property> + <item row="1" column="0"> + <widget class="QLabel" name="labelNBins"> + <property name="minimumSize"> + <size> + <width>60</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string># bins:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="spinBoxNBins"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string>Press enter to recalculate statistics with new bin size.</string> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>10000</number> + </property> + <property name="value"> + <number>100</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QStackedWidget" name="stackWidgetChart"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QmitkChartWidget" name="chartWidget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </widget> + </item> + <item> + <widget class="QLabel" name="labelInfo"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QWidget" name="widgetClipboard" native="true"> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QPushButton" name="buttonCopyHistogramToClipboard"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Copy to Clipboard</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </widget> + <customwidgets> + <customwidget> + <class>QmitkChartWidget</class> + <extends>QWidget</extends> + <header location="global">QmitkChartWidget.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/Modules/ImageStatisticsUI/Qmitk/QmitkHistogramVisualizationWidget.cpp b/Modules/ImageStatisticsUI/Qmitk/QmitkHistogramVisualizationWidget.cpp new file mode 100644 index 0000000000..022d5e848c --- /dev/null +++ b/Modules/ImageStatisticsUI/Qmitk/QmitkHistogramVisualizationWidget.cpp @@ -0,0 +1,69 @@ +/*=================================================================== + +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 "QmitkHistogramVisualizationWidget.h" + +HistogramVisualizationWidget::HistogramVisualizationWidget(QWidget* parent) : QWidget(parent) +{ + if (m_Controls == nullptr) + { + m_Controls = new Ui::QmitkHistogramVisualizationControls; + } + setupUi(this); + CreateConnections(); +} + +void HistogramVisualizationWidget::CreateConnections() +{ + connect(buttonCopyHistogramToClipboard, &QPushButton::clicked, this, &HistogramVisualizationWidget::OnClipboardButtonClicked); + connect(radioButtonBarchart, &QRadioButton::clicked, this, &HistogramVisualizationWidget::OnBarRadioButtonSelected); + connect(radioButtonLinegraph, &QRadioButton::clicked, this, &HistogramVisualizationWidget::OnLineRadioButtonSelected); + connect(checkBoxUseDefaultNBins, &QCheckBox::clicked, this, &HistogramVisualizationWidget::OnDefaultNBinsCheckBoxChanged); + connect(spinBoxNBins, &QSpinBox::editingFinished, this, &HistogramVisualizationWidget::OnNBinsSpinBoxValueChanged); + connect(checkBoxShowSubchart, &QCheckBox::clicked, this, &HistogramVisualizationWidget::OnShowSubchartCheckBoxChanged); +} + +void HistogramVisualizationWidget::EnableAllComponents() +{ + this->setEnabled(true); + groupBoxHistogram->setEnabled(true); + groupBoxPlot->setEnabled(true); + buttonCopyHistogramToClipboard->setEnabled(true); +} + +void HistogramVisualizationWidget::OnClipboardButtonClicked() +{ +} + +void HistogramVisualizationWidget::OnDefaultNBinsCheckBoxChanged() +{ +} + +void HistogramVisualizationWidget::OnNBinsSpinBoxValueChanged() +{ +} + +void HistogramVisualizationWidget::OnShowSubchartCheckBoxChanged() +{ +} + +void HistogramVisualizationWidget::OnBarRadioButtonSelected() +{ +} + +void HistogramVisualizationWidget::OnLineRadioButtonSelected() +{ +} diff --git a/Modules/ImageStatisticsUI/Qmitk/QmitkHistogramVisualizationWidget.h b/Modules/ImageStatisticsUI/Qmitk/QmitkHistogramVisualizationWidget.h new file mode 100644 index 0000000000..b92d5e4eab --- /dev/null +++ b/Modules/ImageStatisticsUI/Qmitk/QmitkHistogramVisualizationWidget.h @@ -0,0 +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. + +===================================================================*/ +#pragma once + +//Qt +#include <QWidget> + +#include <MitkImageStatisticsUIExports.h> +#include <ui_QmitkHistogramVisualizationControls.h> + +class MITKIMAGESTATISTICSUI_EXPORT HistogramVisualizationWidget : public QWidget, private Ui::QmitkHistogramVisualizationControls +{ + Q_OBJECT + +public: + HistogramVisualizationWidget(QWidget* parent = nullptr); + + //void setHistogram(itk::Histogram<double>::ConstPointer h); + +signals: + /** + * \brief Signal to be emitted when the number of bins is changed by the user. The HistogramCalculator should connect to this signal and recalculate the data accordingly. + */ + void RequestHistogramUpdate(unsigned int nBins); + +private: + + void CreateConnections(); + + void EnableAllComponents(); + +//slots + /** \brief Saves the histogram to the clipboard */ + void OnClipboardButtonClicked(); + /** \brief Toogle GUI elements if histogram default bin size checkbox value changed. */ + void OnDefaultNBinsCheckBoxChanged(); + + void OnNBinsSpinBoxValueChanged(); + + void OnShowSubchartCheckBoxChanged(); + + void OnBarRadioButtonSelected(); + + void OnLineRadioButtonSelected(); + +private: + Ui::QmitkHistogramVisualizationControls* m_Controls; +}; \ No newline at end of file diff --git a/Modules/ImageStatisticsUI/files.cmake b/Modules/ImageStatisticsUI/files.cmake new file mode 100644 index 0000000000..6d352e6329 --- /dev/null +++ b/Modules/ImageStatisticsUI/files.cmake @@ -0,0 +1,17 @@ +set(CPP_FILES + Qmitk/QmitkHistogramVisualizationWidget.cpp +) + +set(H_FILES +) + +set(TPP_FILES +) + +set(UI_FILES + Qmitk/QmitkHistogramVisualizationControls.ui +) + +set(MOC_H_FILES + Qmitk/QmitkHistogramVisualizationWidget.h +) diff --git a/Modules/ModuleList.cmake b/Modules/ModuleList.cmake index 00e894d947..7795d85a15 100644 --- a/Modules/ModuleList.cmake +++ b/Modules/ModuleList.cmake @@ -1,82 +1,83 @@ # The entries in the mitk_modules list must be # ordered according to their dependencies. set(MITK_MODULES Core CommandLine AppUtil RDF LegacyIO DataTypesExt Annotation LegacyGL AlgorithmsExt MapperExt DICOMReader DICOMReaderServices DICOMTesting SceneSerializationBase PlanarFigure ImageDenoising ImageExtraction SceneSerialization Gizmo GraphAlgorithms Multilabel + Chart ImageStatistics + ImageStatisticsUI ContourModel SurfaceInterpolation Segmentation PlanarFigureSegmentation QtWidgets QtWidgetsExt - Chart SegmentationUI MatchPointRegistration MatchPointRegistrationUI Classification GPGPU OpenIGTLink IGTBase IGT CameraCalibration OpenCL OpenCVVideoSupport QtOverlays ToFHardware ToFProcessing ToFUI PhotoacousticsHardware PhotoacousticsAlgorithms PhotoacousticsLib US USUI DicomUI Remeshing Python QtPython Persistence OpenIGTLinkUI IGTUI DicomRT RTUI IOExt XNAT TubeGraph BiophotonicsHardware DiffusionImaging TumorInvasionAnalysis BoundingShape RenderWindowManager RenderWindowManagerUI CEST BasicImageProcessing ModelFit ModelFitUI Pharmacokinetics PharmacokineticsUI ) if(MITK_ENABLE_PIC_READER) list(APPEND MITK_MODULES IpPicSupportIO) endif() diff --git a/Plugins/org.mitk.gui.qt.measurementtoolbox/CMakeLists.txt b/Plugins/org.mitk.gui.qt.measurementtoolbox/CMakeLists.txt index 9af2e00fda..8403f27fb6 100644 --- a/Plugins/org.mitk.gui.qt.measurementtoolbox/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.measurementtoolbox/CMakeLists.txt @@ -1,9 +1,9 @@ # The project name must correspond to the directory name of your plug-in # and must not contain periods. project(org_mitk_gui_qt_measurementtoolbox) mitk_create_plugin( EXPORT_DIRECTIVE MITK_QT_MEASUREMENTTOOLBOX EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDS MitkQtWidgetsExt MitkImageStatistics MitkPlanarFigure MitkChart -) + MODULE_DEPENDS MitkQtWidgetsExt MitkImageStatistics MitkImageStatisticsUI MitkPlanarFigure MitkChart +) \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.measurementtoolbox/src/internal/QmitkImageStatisticsReloadedViewControls.ui b/Plugins/org.mitk.gui.qt.measurementtoolbox/src/internal/QmitkImageStatisticsReloadedViewControls.ui index 80ef24ee28..395c159cb8 100644 --- a/Plugins/org.mitk.gui.qt.measurementtoolbox/src/internal/QmitkImageStatisticsReloadedViewControls.ui +++ b/Plugins/org.mitk.gui.qt.measurementtoolbox/src/internal/QmitkImageStatisticsReloadedViewControls.ui @@ -1,78 +1,90 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>QmitkImageStatisticsReloadedViewControls</class> <widget class="QWidget" name="QmitkImageStatisticsReloadedViewControls"> <property name="enabled"> <bool>true</bool> </property> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>548</width> <height>853</height> </rect> </property> <property name="windowTitle"> <string>Form</string> </property> <layout class="QVBoxLayout" name="verticalLayout_4"> <item> <widget class="QGroupBox" name="groupBox_statistics"> <property name="enabled"> <bool>false</bool> </property> <property name="title"> <string>Statistics</string> </property> <layout class="QVBoxLayout" name="verticalLayout"> <property name="leftMargin"> <number>9</number> </property> <property name="rightMargin"> <number>9</number> </property> <property name="bottomMargin"> <number>9</number> </property> </layout> </widget> </item> <item> <widget class="QGroupBox" name="groupBox_histogram"> <property name="enabled"> <bool>false</bool> </property> <property name="minimumSize"> <size> <width>400</width> <height>450</height> </size> </property> <property name="title"> <string>Histogram</string> </property> <property name="checkable"> <bool>false</bool> </property> - <layout class="QVBoxLayout" name="verticalLayout_3"/> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="HistogramVisualizationWidget" name="widget" native="true"/> + </item> + </layout> </widget> </item> <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>20</width> <height>40</height> </size> </property> </spacer> </item> </layout> </widget> + <customwidgets> + <customwidget> + <class>HistogramVisualizationWidget</class> + <extends>QWidget</extends> + <header location="global">QmitkHistogramVisualizationWidget.h</header> + <container>1</container> + </customwidget> + </customwidgets> <resources/> <connections/> </ui>