( maskingNode->GetData() );
-
- //TODO Get 3D Surface of current time step
-
- if(surface.IsNull())
- {
- MITK_ERROR << "Selection does not contain a surface";
- QMessageBox::information( this, "Image and Surface Masking", "Selection does not contain a surface", QMessageBox::Ok );
- this->EnableButtons();
- return;
- }
-
- mitk::Image::Pointer maskImage = this->ConvertSurfaceToImage( referenceImage, surface );
-
- //2. mask reference image with mask image
- if(maskImage.IsNotNull() &&
- referenceImage->GetLargestPossibleRegion().GetSize() == maskImage->GetLargestPossibleRegion().GetSize() )
- {
- resultImage = this->MaskImage( referenceImage, maskImage );
- }
- }
-
- mitk::ProgressBar::GetInstance()->Progress();
-
- if( resultImage.IsNull() )
- {
- MITK_ERROR << "Masking failed";
- QMessageBox::information( this, "Image and Surface Masking", "Masking failed. For more information please see logging window.", QMessageBox::Ok );
- this->EnableButtons();
- mitk::ProgressBar::GetInstance()->Progress(4);
- return;
- }
-
- //Add result to data storage
- this->AddToDataStorage(
- dataSelectionWidget->GetDataStorage(),
- resultImage,
- dataSelectionWidget->GetSelection(0)->GetName() + "_" + dataSelectionWidget->GetSelection(1)->GetName(),
- dataSelectionWidget->GetSelection(0));
-
- this->EnableButtons();
-
- mitk::ProgressBar::GetInstance()->Progress();
-}
-
-mitk::Image::Pointer QmitkImageMaskingWidget::MaskImage(mitk::Image::Pointer referenceImage, mitk::Image::Pointer maskImage )
-{
- mitk::ScalarType backgroundValue = 0.0;
-
- if (m_Controls.rbnMinimum->isChecked())
- {
- backgroundValue = referenceImage->GetStatistics()->GetScalarValueMin();
- }
- else if (m_Controls.rbnCustom->isChecked())
- {
- auto warningTitle = QStringLiteral("Invalid custom pixel value");
-
- bool ok = false;
- auto originalBackgroundValue = m_Controls.txtCustom->text().toDouble(&ok);
-
- if (!ok)
- {
- // Input is not even a number
- QMessageBox::warning(nullptr, warningTitle, "Please enter a valid number as custom pixel value.");
- return nullptr;
- }
- else
- {
- // Clamp to the numerical limits of the pixel/component type
- double bottom, top;
- if (referenceImage->GetDimension() == 4)
- {
- AccessFixedDimensionByItk_n(referenceImage, GetRange, 4, (bottom, top));
- }
- else
- {
- AccessByItk_n(referenceImage, GetRange, (bottom, top));
- }
- backgroundValue = std::max(bottom, std::min(originalBackgroundValue, top));
-
- // Get rid of decimals for integral numbers
- auto type = referenceImage->GetPixelType().GetComponentType();
- if (type != itk::IOComponentEnum::FLOAT && type != itk::IOComponentEnum::DOUBLE)
- backgroundValue = std::round(backgroundValue);
- }
-
- // Ask the user for permission before correcting their input
- if (std::abs(originalBackgroundValue - backgroundValue) > 1e-4)
- {
- auto warningText = QString(
- "The custom pixel value %1 lies not within the range of valid pixel values for the selected image.
"
- "Apply the closest valid pixel value %2 instead?
").arg(originalBackgroundValue).arg(backgroundValue);
-
- auto ret = QMessageBox::warning(
- nullptr,
- warningTitle,
- warningText,
- QMessageBox::StandardButton::Apply | QMessageBox::StandardButton::Cancel,
- QMessageBox::StandardButton::Apply);
-
- if (QMessageBox::StandardButton::Apply != ret)
- return nullptr;
-
- m_Controls.txtCustom->setText(QString("%1").arg(backgroundValue));
- }
- }
-
- auto maskFilter = mitk::MaskImageFilter::New();
- maskFilter->SetInput(referenceImage);
- maskFilter->SetMask(maskImage);
- maskFilter->OverrideOutsideValueOn();
- maskFilter->SetOutsideValue(backgroundValue);
-
- try
- {
- maskFilter->Update();
- }
- catch(const itk::ExceptionObject& e)
- {
- MITK_ERROR << e.GetDescription();
- return nullptr;
- }
-
- return maskFilter->GetOutput();
-}
-
-mitk::Image::Pointer QmitkImageMaskingWidget::ConvertSurfaceToImage( mitk::Image::Pointer image, mitk::Surface::Pointer surface )
-{
- mitk::ProgressBar::GetInstance()->AddStepsToDo(2);
- mitk::ProgressBar::GetInstance()->Progress();
-
- mitk::SurfaceToImageFilter::Pointer surfaceToImageFilter = mitk::SurfaceToImageFilter::New();
- surfaceToImageFilter->MakeOutputBinaryOn();
- surfaceToImageFilter->SetInput(surface);
- surfaceToImageFilter->SetImage(image);
- try
- {
- surfaceToImageFilter->Update();
- }
- catch(itk::ExceptionObject& excpt)
- {
- MITK_ERROR << excpt.GetDescription();
- return nullptr;
- }
-
- mitk::ProgressBar::GetInstance()->Progress();
- mitk::Image::Pointer resultImage = mitk::Image::New();
- resultImage = surfaceToImageFilter->GetOutput();
-
- return resultImage;
-}
-
-void QmitkImageMaskingWidget::AddToDataStorage(mitk::DataStorage::Pointer dataStorage, mitk::Image::Pointer segmentation, const std::string& name, mitk::DataNode::Pointer parent )
-{
- auto dataNode = mitk::DataNode::New();
-
- dataNode->SetName(name);
- dataNode->SetData(segmentation);
-
- if (parent.IsNotNull())
- {
- mitk::LevelWindow levelWindow;
- parent->GetLevelWindow(levelWindow);
- dataNode->SetLevelWindow(levelWindow);
- }
-
- dataStorage->Add(dataNode, parent);
-}
diff --git a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/ImageMasking/QmitkImageMaskingWidget.h b/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/ImageMasking/QmitkImageMaskingWidget.h
deleted file mode 100644
index 7a24096fb5..0000000000
--- a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/ImageMasking/QmitkImageMaskingWidget.h
+++ /dev/null
@@ -1,77 +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.
-
-============================================================================*/
-
-#ifndef QmitkImageMaskingWidget_h
-#define QmitkImageMaskingWidget_h
-
-#include "../QmitkSegmentationUtilityWidget.h"
-#include
-
-#include
-
-namespace mitk {
- class Image;
-}
-
-/*!
- \brief QmitkImageMaskingWidget
-
- Tool masks an image with a binary image or a surface. The Method requires
- an image and a binary image mask or a surface. The input image and the binary
- image mask must be of the same size. Masking with a surface creates first a
- binary image of the surface and then use this for the masking of the input image.
-*/
-class QmitkImageMaskingWidget : public QmitkSegmentationUtilityWidget
-{
- Q_OBJECT
-
-public:
-
- /** @brief Default constructor, including creation of GUI elements and signals/slots connections. */
- explicit QmitkImageMaskingWidget(mitk::SliceNavigationController* timeNavigationController, QWidget* parent = nullptr);
-
- /** @brief Defaul destructor. */
- ~QmitkImageMaskingWidget() override;
-
-private slots:
-
- /** @brief This slot is called if the selection in the workbench is changed. */
- void OnSelectionChanged(unsigned int index, const mitk::DataNode* selection);
-
- /** @brief This slot is called if user activates the button to mask an image. */
- void OnMaskImagePressed();
-
- /** @brief This slot is called if the user toggles the "Custom" radio button. */
- void OnCustomValueButtonToggled(bool checked);
-
-private:
-
- /** @brief Check if selections is valid. */
- void SelectionControl( unsigned int index, const mitk::DataNode* selection);
-
- /** @brief Enable buttons if data selction is valid. */
- void EnableButtons(bool enable = true);
-
- /** @brief Mask an image with a given binary mask. Note that the input image and the mask image must be of the same size. */
- itk::SmartPointer MaskImage(itk::SmartPointer referenceImage, itk::SmartPointer maskImage );
-
- /** @brief Convert a surface into an binary image. */
- itk::SmartPointer ConvertSurfaceToImage( itk::SmartPointer image, mitk::Surface::Pointer surface );
-
- /** @brief Adds a new data object to the DataStorage.*/
- void AddToDataStorage(mitk::DataStorage::Pointer dataStorage, itk::SmartPointer segmentation,
- const std::string& name, mitk::DataNode::Pointer parent = nullptr);
-
- Ui::QmitkImageMaskingWidgetControls m_Controls;
-};
-
-#endif
diff --git a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/ImageMasking/QmitkImageMaskingWidgetControls.ui b/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/ImageMasking/QmitkImageMaskingWidgetControls.ui
deleted file mode 100644
index ff45a758c6..0000000000
--- a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/ImageMasking/QmitkImageMaskingWidgetControls.ui
+++ /dev/null
@@ -1,109 +0,0 @@
-
-
- QmitkImageMaskingWidgetControls
-
-
-
- 0
- 0
- 238
- 329
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
- Background value
-
-
-
-
-
-
- Zero
-
-
- true
-
-
-
- -
-
-
- Minimum
-
-
-
- -
-
-
-
-
-
-
- 0
- 0
-
-
-
- Custom:
-
-
-
- -
-
-
- false
-
-
- 0
-
-
-
-
-
-
-
-
- -
-
-
- Mask
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
-
-
-
- QmitkDataSelectionWidget
- QWidget
- internal/Common/QmitkDataSelectionWidget.h
- 1
-
-
-
-
-
diff --git a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/MorphologicalOperations/QmitkMorphologicalOperationsWidget.cpp b/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/MorphologicalOperations/QmitkMorphologicalOperationsWidget.cpp
deleted file mode 100644
index 5a15febb83..0000000000
--- a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/MorphologicalOperations/QmitkMorphologicalOperationsWidget.cpp
+++ /dev/null
@@ -1,251 +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 "QmitkMorphologicalOperationsWidget.h"
-#include
-#include
-#include
-
-static const char* const HelpText = "Select a segmentation above";
-
-QmitkMorphologicalOperationsWidget::QmitkMorphologicalOperationsWidget(mitk::SliceNavigationController* timeNavigationController, QWidget* parent)
- : QmitkSegmentationUtilityWidget(timeNavigationController, parent)
-{
- m_Controls.setupUi(this);
-
- m_Controls.dataSelectionWidget->AddDataSelection(QmitkDataSelectionWidget::SegmentationPredicate);
- m_Controls.dataSelectionWidget->SetHelpText(HelpText);
-
- connect(m_Controls.btnClosing, SIGNAL(clicked()), this, SLOT(OnClosingButtonClicked()));
- connect(m_Controls.btnOpening, SIGNAL(clicked()), this, SLOT(OnOpeningButtonClicked()));
- connect(m_Controls.btnDilatation, SIGNAL(clicked()), this, SLOT(OnDilatationButtonClicked()));
- connect(m_Controls.btnErosion, SIGNAL(clicked()), this, SLOT(OnErosionButtonClicked()));
- connect(m_Controls.btnFillHoles, SIGNAL(clicked()), this, SLOT(OnFillHolesButtonClicked()));
- connect(m_Controls.radioButtonMorphoCross, SIGNAL(clicked()), this, SLOT(OnRadioButtonsClicked()));
- connect(m_Controls.radioButtonMorphoBall, SIGNAL(clicked()), this, SLOT(OnRadioButtonsClicked()));
- connect(m_Controls.dataSelectionWidget, SIGNAL(SelectionChanged(unsigned int, const mitk::DataNode*)), this, SLOT(OnSelectionChanged(unsigned int, const mitk::DataNode*)));
-
- if (m_Controls.dataSelectionWidget->GetSelection(0).IsNotNull())
- this->OnSelectionChanged(0, m_Controls.dataSelectionWidget->GetSelection(0));
-}
-
-QmitkMorphologicalOperationsWidget::~QmitkMorphologicalOperationsWidget()
-{
-}
-
-void QmitkMorphologicalOperationsWidget::OnSelectionChanged(unsigned int, const mitk::DataNode*)
-{
- QmitkDataSelectionWidget* dataSelectionWidget = m_Controls.dataSelectionWidget;
- mitk::DataNode::Pointer node = dataSelectionWidget->GetSelection(0);
-
- if (node.IsNotNull())
- {
- m_Controls.dataSelectionWidget->SetHelpText("");
- this->EnableButtons(true);
- }
- else
- {
- m_Controls.dataSelectionWidget->SetHelpText(HelpText);
- this->EnableButtons(false);
- }
-}
-
-void QmitkMorphologicalOperationsWidget::EnableButtons(bool enable)
-{
- m_Controls.btnClosing->setEnabled(enable);
- m_Controls.btnDilatation->setEnabled(enable);
- m_Controls.btnErosion->setEnabled(enable);
- m_Controls.btnFillHoles->setEnabled(enable);
- m_Controls.btnOpening->setEnabled(enable);
-}
-
-void QmitkMorphologicalOperationsWidget::OnRadioButtonsClicked()
-{
- bool enable = m_Controls.radioButtonMorphoBall->isChecked();
-
- m_Controls.sliderMorphFactor->setEnabled(enable);
- m_Controls.spinBoxMorphFactor->setEnabled(enable);
-}
-
-void QmitkMorphologicalOperationsWidget::OnClosingButtonClicked()
-{
- QApplication::setOverrideCursor(QCursor(Qt::BusyCursor));
- mitk::RenderingManager::GetInstance()->RequestUpdateAll();
-
- QmitkDataSelectionWidget* dataSelectionWidget = m_Controls.dataSelectionWidget;
- mitk::DataNode::Pointer node = dataSelectionWidget->GetSelection(0);
- mitk::Image::Pointer image = static_cast(node->GetData());
- mitk::MorphologicalOperations::StructuralElementType structuralElement = CreateStructerElement_UI();
- try
- {
- int factor = m_Controls.spinBoxMorphFactor->isEnabled()
- ? m_Controls.spinBoxMorphFactor->value()
- : 1;
-
- mitk::MorphologicalOperations::Closing(image, factor, structuralElement);
- }
- catch (const itk::ExceptionObject& exception)
- {
- MITK_WARN << "Exception caught: " << exception.GetDescription();
-
- QApplication::restoreOverrideCursor();
- return;
- }
-
- node->SetData(image);
-
- mitk::RenderingManager::GetInstance()->RequestUpdateAll();
- QApplication::restoreOverrideCursor();
-}
-
-void QmitkMorphologicalOperationsWidget::OnOpeningButtonClicked()
-{
- QApplication::setOverrideCursor(QCursor(Qt::BusyCursor));
- mitk::RenderingManager::GetInstance()->RequestUpdateAll();
-
- QmitkDataSelectionWidget* dataSelectionWidget = m_Controls.dataSelectionWidget;
- mitk::DataNode::Pointer node = dataSelectionWidget->GetSelection(0);
- mitk::Image::Pointer image = static_cast(node->GetData());
-
- mitk::MorphologicalOperations::StructuralElementType structuralElement = CreateStructerElement_UI();
-
- try
- {
- int factor = m_Controls.spinBoxMorphFactor->isEnabled()
- ? m_Controls.spinBoxMorphFactor->value()
- : 1;
-
- mitk::MorphologicalOperations::Opening(image, factor, structuralElement);
- }
- catch (const itk::ExceptionObject& exception)
- {
- MITK_WARN << "Exception caught: " << exception.GetDescription();
-
- QApplication::restoreOverrideCursor();
- return;
- }
-
- node->SetData(image);
-
- mitk::RenderingManager::GetInstance()->RequestUpdateAll();
- QApplication::restoreOverrideCursor();
-}
-
-void QmitkMorphologicalOperationsWidget::OnDilatationButtonClicked()
-{
- QApplication::setOverrideCursor(QCursor(Qt::BusyCursor));
- mitk::RenderingManager::GetInstance()->RequestUpdateAll();
-
- QmitkDataSelectionWidget* dataSelectionWidget = m_Controls.dataSelectionWidget;
- mitk::DataNode::Pointer node = dataSelectionWidget->GetSelection(0);
- mitk::Image::Pointer image = static_cast(node->GetData());
- mitk::MorphologicalOperations::StructuralElementType structuralElement = this->CreateStructerElement_UI();
-
- try
- {
- int factor = m_Controls.spinBoxMorphFactor->isEnabled()
- ? m_Controls.spinBoxMorphFactor->value()
- : 1;
-
- mitk::MorphologicalOperations::Dilate(image, factor, structuralElement);
- }
- catch (const itk::ExceptionObject& exception)
- {
- MITK_WARN << "Exception caught: " << exception.GetDescription();
-
- QApplication::restoreOverrideCursor();
- return;
- }
-
- node->SetData(image);
-
- mitk::RenderingManager::GetInstance()->RequestUpdateAll();
- QApplication::restoreOverrideCursor();
-}
-
-void QmitkMorphologicalOperationsWidget::OnErosionButtonClicked()
-{
- QApplication::setOverrideCursor(QCursor(Qt::BusyCursor));
- mitk::RenderingManager::GetInstance()->RequestUpdateAll();
-
- QmitkDataSelectionWidget* dataSelectionWidget = m_Controls.dataSelectionWidget;
- mitk::DataNode::Pointer node = dataSelectionWidget->GetSelection(0);
- mitk::Image::Pointer image = static_cast(node->GetData());
-mitk::MorphologicalOperations::StructuralElementType structuralElement = CreateStructerElement_UI();
-
- try
- {
- int factor = m_Controls.spinBoxMorphFactor->isEnabled()
- ? m_Controls.spinBoxMorphFactor->value()
- : 1;
-
- mitk::MorphologicalOperations::Erode(image, factor, structuralElement);
- }
- catch (const itk::ExceptionObject& exception)
- {
- MITK_WARN << "Exception caught: " << exception.GetDescription();
-
- QApplication::restoreOverrideCursor();
- return;
- }
-
- node->SetData(image);
-
- mitk::RenderingManager::GetInstance()->RequestUpdateAll();
- QApplication::restoreOverrideCursor();
-}
-
-void QmitkMorphologicalOperationsWidget::OnFillHolesButtonClicked()
-{
- QApplication::setOverrideCursor(QCursor(Qt::BusyCursor));
- mitk::RenderingManager::GetInstance()->RequestUpdateAll();
-
- QmitkDataSelectionWidget* dataSelectionWidget = m_Controls.dataSelectionWidget;
- mitk::DataNode::Pointer node = dataSelectionWidget->GetSelection(0);
- mitk::Image::Pointer image = static_cast(node->GetData());
-
- try
- {
- mitk::MorphologicalOperations::FillHoles(image);
- }
- catch (const itk::ExceptionObject& exception)
- {
- MITK_WARN << "Exception caught: " << exception.GetDescription();
-
- QApplication::restoreOverrideCursor();
- return;
- }
-
- node->SetData(image);
-
- mitk::RenderingManager::GetInstance()->RequestUpdateAll();
- QApplication::restoreOverrideCursor();
-}
-
-
-mitk::MorphologicalOperations::StructuralElementType QmitkMorphologicalOperationsWidget::CreateStructerElement_UI()
-{
- bool ball = m_Controls.radioButtonMorphoBall->isChecked();
- int accum_flag = 0;
- if(ball){
- if(m_Controls.planeSelectionComboBox->currentIndex() == 0) accum_flag = mitk::MorphologicalOperations::Ball; // 3D Operation
- if(m_Controls.planeSelectionComboBox->currentIndex() == 1) accum_flag = mitk::MorphologicalOperations::Ball_Axial; // 2D Operation - Axial plane
- if(m_Controls.planeSelectionComboBox->currentIndex() == 2) accum_flag = mitk::MorphologicalOperations::Ball_Sagittal; // 2D Operation - Sagittal plane
- if(m_Controls.planeSelectionComboBox->currentIndex() == 3) accum_flag = mitk::MorphologicalOperations::Ball_Coronal; // 2D Operation - Coronal plane
- }else{
- if(m_Controls.planeSelectionComboBox->currentIndex() == 0) accum_flag = mitk::MorphologicalOperations::Cross;
- if(m_Controls.planeSelectionComboBox->currentIndex() == 1) accum_flag = mitk::MorphologicalOperations::Cross_Axial;
- if(m_Controls.planeSelectionComboBox->currentIndex() == 2) accum_flag = mitk::MorphologicalOperations::Cross_Sagittal;
- if(m_Controls.planeSelectionComboBox->currentIndex() == 3) accum_flag = mitk::MorphologicalOperations::Cross_Coronal;
- }
- return (mitk::MorphologicalOperations::StructuralElementType)accum_flag;
-}
diff --git a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/MorphologicalOperations/QmitkMorphologicalOperationsWidget.h b/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/MorphologicalOperations/QmitkMorphologicalOperationsWidget.h
deleted file mode 100644
index 386b1152b4..0000000000
--- a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/MorphologicalOperations/QmitkMorphologicalOperationsWidget.h
+++ /dev/null
@@ -1,47 +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.
-
-============================================================================*/
-
-#ifndef QmitkMorphologicalOperationsWidget_h
-#define QmitkMorphologicalOperationsWidget_h
-
-#include "../QmitkSegmentationUtilityWidget.h"
-#include
-#include
-
-/** \brief GUI class for morphological segmentation tools.
- */
-class QmitkMorphologicalOperationsWidget : public QmitkSegmentationUtilityWidget
-{
- Q_OBJECT
-
-public:
- explicit QmitkMorphologicalOperationsWidget(mitk::SliceNavigationController* timeNavigationController, QWidget* parent = nullptr);
- ~QmitkMorphologicalOperationsWidget() override;
-
-public slots:
- void OnClosingButtonClicked();
- void OnOpeningButtonClicked();
- void OnDilatationButtonClicked();
- void OnErosionButtonClicked();
- void OnFillHolesButtonClicked();
- void OnSelectionChanged(unsigned int index, const mitk::DataNode* selection);
- void OnRadioButtonsClicked();
-
-protected:
- void EnableButtons(bool enable);
-
-private:
- Ui::QmitkMorphologicalOperationsWidgetControls m_Controls;
- mitk::MorphologicalOperations::StructuralElementType CreateStructerElement_UI();
-};
-
-#endif
diff --git a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/MorphologicalOperations/QmitkMorphologicalOperationsWidgetControls.ui b/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/MorphologicalOperations/QmitkMorphologicalOperationsWidgetControls.ui
deleted file mode 100644
index b328a3b7ad..0000000000
--- a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/MorphologicalOperations/QmitkMorphologicalOperationsWidgetControls.ui
+++ /dev/null
@@ -1,323 +0,0 @@
-
-
- QmitkMorphologicalOperationsWidgetControls
-
-
-
- 0
- 0
- 184
- 377
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
- Structuring Element
-
-
-
-
-
-
- Ball
-
-
- true
-
-
-
- -
-
-
- Cross
-
-
-
- -
-
-
-
-
- 3D Operation
-
-
- -
-
- 2D Operation - Axial
-
-
- -
-
- 2D Operation - Sagittal
-
-
- -
-
- 2D Operation - Coronal
-
-
-
-
-
-
-
- -
-
-
-
-
-
- Radius
-
-
-
- -
-
-
- 1
-
-
- 20
-
-
- 1
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- 1
-
-
- 20
-
-
-
-
-
- -
-
-
-
-
-
- false
-
-
-
- 0
- 0
-
-
-
- Dilation
-
-
-
- :/SegmentationUtilities/MorphologicalOperations/Dilate_48x48.png:/SegmentationUtilities/MorphologicalOperations/Dilate_48x48.png
-
-
-
- 32
- 32
-
-
-
- Qt::ToolButtonTextUnderIcon
-
-
-
- -
-
-
- false
-
-
-
- 0
- 0
-
-
-
- Erosion
-
-
-
- :/SegmentationUtilities/MorphologicalOperations/Erode_48x48.png:/SegmentationUtilities/MorphologicalOperations/Erode_48x48.png
-
-
-
- 32
- 32
-
-
-
- Qt::ToolButtonTextUnderIcon
-
-
-
- -
-
-
- false
-
-
-
- 0
- 0
-
-
-
- Closing
-
-
-
- :/SegmentationUtilities/MorphologicalOperations/Closing_48x48.png:/SegmentationUtilities/MorphologicalOperations/Closing_48x48.png
-
-
-
- 32
- 32
-
-
-
- Qt::ToolButtonTextUnderIcon
-
-
-
- -
-
-
- false
-
-
-
- 0
- 0
-
-
-
- Opening
-
-
-
- :/SegmentationUtilities/MorphologicalOperations/Opening_48x48.png:/SegmentationUtilities/MorphologicalOperations/Opening_48x48.png
-
-
-
- 32
- 32
-
-
-
- Qt::ToolButtonTextUnderIcon
-
-
-
- -
-
-
- false
-
-
-
- 0
- 0
-
-
-
- Globally fills holes in segmentation (structuring element and radius not required)
-
-
- Fill Holes
-
-
-
- :/SegmentationUtilities/MorphologicalOperations/FillHoles_48x48.png:/SegmentationUtilities/MorphologicalOperations/FillHoles_48x48.png
-
-
-
- 32
- 32
-
-
-
- Qt::ToolButtonTextUnderIcon
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
-
-
-
- QmitkDataSelectionWidget
- QWidget
- internal/Common/QmitkDataSelectionWidget.h
- 1
-
-
-
-
-
-
-
- sliderMorphFactor
- valueChanged(int)
- spinBoxMorphFactor
- setValue(int)
-
-
- 240
- 27
-
-
- 766
- 36
-
-
-
-
- spinBoxMorphFactor
- valueChanged(int)
- sliderMorphFactor
- setValue(int)
-
-
- 784
- 38
-
-
- 657
- 38
-
-
-
-
-
diff --git a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/QmitkSegmentationUtilityWidget.cpp b/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/QmitkSegmentationUtilityWidget.cpp
deleted file mode 100644
index 2389dda82b..0000000000
--- a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/QmitkSegmentationUtilityWidget.cpp
+++ /dev/null
@@ -1,34 +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 "QmitkSegmentationUtilityWidget.h"
-
-QmitkSegmentationUtilityWidget::QmitkSegmentationUtilityWidget(mitk::SliceNavigationController* timeNavigationController, QWidget* parent)
- : QWidget(parent)
-{
- this->SetTimeNavigationController(timeNavigationController);
-}
-
-QmitkSegmentationUtilityWidget::~QmitkSegmentationUtilityWidget()
-{
-}
-
-mitk::SliceNavigationController* QmitkSegmentationUtilityWidget::GetTimeNavigationController() const
-{
- return m_TimeNavigationController;
-}
-
-void QmitkSegmentationUtilityWidget::SetTimeNavigationController(mitk::SliceNavigationController* timeNavigationController)
-{
- m_TimeNavigationController = timeNavigationController;
- this->setEnabled(timeNavigationController != nullptr);
-}
diff --git a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/QmitkSegmentationUtilityWidget.h b/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/QmitkSegmentationUtilityWidget.h
deleted file mode 100644
index 80e988c1ea..0000000000
--- a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/QmitkSegmentationUtilityWidget.h
+++ /dev/null
@@ -1,51 +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.
-
-============================================================================*/
-
-#ifndef QmitkSegmentationUtilityWidget_h
-#define QmitkSegmentationUtilityWidget_h
-
-#include
-
-namespace mitk
-{
- class SliceNavigationController;
-}
-
-/** \brief Base class for segmentation utility widgets that need access to the time navigation controller.
- *
- * Call GetTimeNavigationController() in your derived class to gain access to the time navigation controller.
- * The time navigation controller is not not available at all times and hence this method can return nullptr.
- */
-class QmitkSegmentationUtilityWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit QmitkSegmentationUtilityWidget(mitk::SliceNavigationController* timeNavigationController, QWidget* parent = nullptr);
- ~QmitkSegmentationUtilityWidget() override;
-
- /** \brief Usually called only from QmitkSegmentationUtilitiesView::RenderWindowPartActivated() and QmitkSegmentationUtilitiesView::RenderWindowPartDeactivated().
- */
- void SetTimeNavigationController(mitk::SliceNavigationController* timeNavigationController);
-
-protected:
- /** \brief Call this method to access the time navigation controller.
- *
- * \return Pointer to the time navigation controller or nullptr, if it is not available.
- */
- mitk::SliceNavigationController* GetTimeNavigationController() const;
-
-private:
- mitk::SliceNavigationController* m_TimeNavigationController;
-};
-
-#endif
diff --git a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/SurfaceToImage/QmitkSurfaceToImageWidget.cpp b/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/SurfaceToImage/QmitkSurfaceToImageWidget.cpp
deleted file mode 100644
index d358c17492..0000000000
--- a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/SurfaceToImage/QmitkSurfaceToImageWidget.cpp
+++ /dev/null
@@ -1,157 +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 "QmitkSurfaceToImageWidget.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-static const char* const HelpText = "Select an image and a surface above";
-
-QmitkSurfaceToImageWidget::QmitkSurfaceToImageWidget(mitk::SliceNavigationController* timeNavigationController, QWidget* parent)
- : QmitkSegmentationUtilityWidget(timeNavigationController, parent)
-{
- m_Controls.setupUi(this);
-
- m_Controls.dataSelectionWidget->AddDataSelection(QmitkDataSelectionWidget::ImageAndSegmentationPredicate);
- m_Controls.dataSelectionWidget->AddDataSelection(QmitkDataSelectionWidget::SurfacePredicate);
- m_Controls.dataSelectionWidget->SetHelpText(HelpText);
-
- this->EnableButtons(false);
-
- connect (m_Controls.btnSurface2Image, SIGNAL(pressed()), this, SLOT(OnSurface2ImagePressed()));
- connect(m_Controls.dataSelectionWidget, SIGNAL(SelectionChanged(unsigned int, const mitk::DataNode*)),
- this, SLOT(OnSelectionChanged(unsigned int, const mitk::DataNode*)));
-
- if( m_Controls.dataSelectionWidget->GetSelection(0).IsNotNull() &&
- m_Controls.dataSelectionWidget->GetSelection(1).IsNotNull() )
- {
- this->OnSelectionChanged(0, m_Controls.dataSelectionWidget->GetSelection(0));
- }
-}
-
-QmitkSurfaceToImageWidget::~QmitkSurfaceToImageWidget()
-{
-}
-
-void QmitkSurfaceToImageWidget::EnableButtons(bool enable)
-{
- m_Controls.btnSurface2Image->setEnabled(enable);
-}
-
-void QmitkSurfaceToImageWidget::OnSelectionChanged(unsigned int, const mitk::DataNode*)
-{
- QmitkDataSelectionWidget* dataSelectionWidget = m_Controls.dataSelectionWidget;
- mitk::DataNode::Pointer imageNode = dataSelectionWidget->GetSelection(0);
- mitk::DataNode::Pointer surfaceNode = dataSelectionWidget->GetSelection(1);
-
- if (imageNode.IsNull() || surfaceNode.IsNull() )
- {
- dataSelectionWidget->SetHelpText(HelpText);
- this->EnableButtons(false);
- }
- else
- {
- mitk::Image::Pointer image = dynamic_cast( dataSelectionWidget->GetSelection(0)->GetData() );
- mitk::Surface::Pointer surface = dynamic_cast( dataSelectionWidget->GetSelection(1)->GetData() );
- if( image->GetTimeSteps() != surface->GetTimeSteps() )
- {
- dataSelectionWidget->SetHelpText("Image and surface are of different size");
- this->EnableButtons(false);
- }
- else
- {
- dataSelectionWidget->SetHelpText("");
- this->EnableButtons();
- }
- }
-}
-
-void QmitkSurfaceToImageWidget::OnSurface2ImagePressed()
-{
- this->EnableButtons(false);
-
- QmitkDataSelectionWidget* dataSelectionWidget = m_Controls.dataSelectionWidget;
- mitk::Image::Pointer image = dynamic_cast( dataSelectionWidget->GetSelection(0)->GetData() );
- mitk::Surface::Pointer surface = dynamic_cast( dataSelectionWidget->GetSelection(1)->GetData() );
-
- if( image.IsNull() || surface.IsNull())
- {
- MITK_ERROR << "Selection does not contain an image and/or a surface";
- QMessageBox::information( this, "Surface To Image", "Selection does not contain an image and/or a surface", QMessageBox::Ok );
- this->EnableButtons();
- return;
- }
-
- mitk::Image::Pointer resultImage(nullptr);
- resultImage = this->ConvertSurfaceToImage( image, surface );
-
- if( resultImage.IsNull() )
- {
- MITK_ERROR << "Convert Surface to binary image failed";
- QMessageBox::information( this, "Surface To Image", "Convert Surface to binary image failed", QMessageBox::Ok );
- this->EnableButtons();
- return;
- }
-
- //create name for result node
- std::string nameOfResultImage = dataSelectionWidget->GetSelection(0)->GetName();
- nameOfResultImage.append("_");
- nameOfResultImage.append(dataSelectionWidget->GetSelection(1)->GetName());
-
- //create data node and add to data storage
- mitk::DataNode::Pointer resultNode = mitk::DataNode::New();
- resultNode->SetData( resultImage );
- resultNode->SetProperty("name", mitk::StringProperty::New(nameOfResultImage) );
-// resultNode->SetProperty("binary", mitk::BoolProperty::New(true) );
-
- dataSelectionWidget->GetDataStorage()->Add(resultNode, dataSelectionWidget->GetSelection(0));
-
- this->EnableButtons();
-}
-
-mitk::LabelSetImage::Pointer QmitkSurfaceToImageWidget::ConvertSurfaceToImage( mitk::Image::Pointer image, mitk::Surface::Pointer surface )
-{
- mitk::ProgressBar::GetInstance()->AddStepsToDo(2);
- mitk::ProgressBar::GetInstance()->Progress();
-
- mitk::SurfaceToImageFilter::Pointer surfaceToImageFilter = mitk::SurfaceToImageFilter::New();
- surfaceToImageFilter->MakeOutputBinaryOn();
- surfaceToImageFilter->SetInput(surface);
- surfaceToImageFilter->SetImage(image);
- try
- {
- surfaceToImageFilter->Update();
- }
- catch(itk::ExceptionObject& excpt)
- {
- MITK_ERROR << excpt.GetDescription();
- return nullptr;
- }
-
- mitk::ProgressBar::GetInstance()->Progress();
-
- mitk::Image::Pointer resultImage = surfaceToImageFilter->GetOutput();
- mitk::LabelSetImage::Pointer multilabelImage = mitk::LabelSetImage::New();
- multilabelImage->InitializeByLabeledImage(resultImage);
-
- return multilabelImage;
-}
-
diff --git a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/SurfaceToImage/QmitkSurfaceToImageWidget.h b/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/SurfaceToImage/QmitkSurfaceToImageWidget.h
deleted file mode 100644
index 9c8895fbe3..0000000000
--- a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/SurfaceToImage/QmitkSurfaceToImageWidget.h
+++ /dev/null
@@ -1,64 +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.
-
-============================================================================*/
-
-#ifndef QmitkSurfaceToImageWidget_h
-#define QmitkSurfaceToImageWidget_h
-
-#include "../QmitkSegmentationUtilityWidget.h"
-#include
-
-namespace mitk {
- class Surface;
- class Image;
- class LabelSetImage;
-}
-
-/*!
- \brief QmitkSurfaceToImageWidget
-
- The Tool converts a surface to a binary image. The Method requires
- a surface and an image, which header information defines the output
- image. The resulting binary image has the same dimension, size, and
- Geometry3D as the input image.
-*/
-class QmitkSurfaceToImageWidget : public QmitkSegmentationUtilityWidget
-{
- Q_OBJECT
-
-public:
-
- /** @brief Default constructor, including creation of GUI elements and signals/slots connections. */
- explicit QmitkSurfaceToImageWidget(mitk::SliceNavigationController* timeNavigationController, QWidget* parent = nullptr);
-
- /** @brief Defaul destructor. */
- ~QmitkSurfaceToImageWidget() override;
-
-private slots:
-
- /** @brief This slot is called if the selection in the workbench is changed. */
- void OnSelectionChanged(unsigned int index, const mitk::DataNode* selection);
-
- /** @brief This slot is called if user activates the button to convert a surface into a binary image. */
- void OnSurface2ImagePressed();
-
-private:
-
- /** @brief Enable buttons if data selction is valid. */
- void EnableButtons(bool enable = true);
-
- /** @brief Convert a surface into an binary image. */
- itk::SmartPointer ConvertSurfaceToImage( itk::SmartPointer image, itk::SmartPointer surface );
-
- Ui::QmitkSurfaceToImageWidgetControls m_Controls;
-};
-
-#endif
diff --git a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/SurfaceToImage/QmitkSurfaceToImageWidgetControls.ui b/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/SurfaceToImage/QmitkSurfaceToImageWidgetControls.ui
deleted file mode 100644
index a9ae0103d8..0000000000
--- a/Plugins/org.mitk.gui.qt.segmentation/src/internal/SegmentationUtilities/SurfaceToImage/QmitkSurfaceToImageWidgetControls.ui
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
- QmitkSurfaceToImageWidgetControls
-
-
-
- 0
- 0
- 98
- 62
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
- Convert
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
-
-
-
- QmitkDataSelectionWidget
- QWidget
- internal/Common/QmitkDataSelectionWidget.h
- 1
-
-
-
-
-