diff --git a/Modules/Segmentation/Interactions/mitkWatershedTool.cpp b/Modules/Segmentation/Interactions/mitkWatershedTool.cpp index 47e29e4da4..6671c1604c 100644 --- a/Modules/Segmentation/Interactions/mitkWatershedTool.cpp +++ b/Modules/Segmentation/Interactions/mitkWatershedTool.cpp @@ -1,188 +1,158 @@ /*============================================================================ 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 "mitkWatershedTool.h" #include "mitkIOUtil.h" #include "mitkITKImageImport.h" #include "mitkImage.h" #include "mitkLabelSetImage.h" #include "mitkImageAccessByItk.h" #include "mitkImageCast.h" #include "mitkImageStatisticsHolder.h" #include "mitkLevelWindowManager.h" #include "mitkLookupTable.h" #include "mitkLookupTableProperty.h" #include "mitkProgressBar.h" #include "mitkRenderingManager.h" #include "mitkRenderingModeProperty.h" #include "mitkToolCommand.h" #include "mitkToolManager.h" #include #include #include #include #include #include #include #include #include namespace mitk { MITK_TOOL_MACRO(MITKSEGMENTATION_EXPORT, WatershedTool, "Watershed tool"); } -mitk::WatershedTool::WatershedTool() : m_Threshold(0.0), m_Level(0.0) -{ -} - -mitk::WatershedTool::~WatershedTool() -{ -} void mitk::WatershedTool::Activated() { Superclass::Activated(); -} -void mitk::WatershedTool::Deactivated() -{ - Superclass::Deactivated(); + m_Level = 0.0; + m_Threshold = 0.0; + + m_MagFilter = nullptr; + m_WatershedFilter = nullptr; + m_LastFilterInput = nullptr; } us::ModuleResource mitk::WatershedTool::GetIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); us::ModuleResource resource = module->GetResource("Watershed_48x48.png"); return resource; } const char **mitk::WatershedTool::GetXPM() const { return nullptr; } const char *mitk::WatershedTool::GetName() const { return "Watershed"; } -void mitk::WatershedTool::DoIt() +mitk::LabelSetImage::Pointer mitk::WatershedTool::ComputeMLPreview(const Image* inputAtTimeStep, TimeStepType /*timeStep*/) { - // get image from tool manager - mitk::DataNode::Pointer referenceData = m_ToolManager->GetReferenceData(0); - mitk::Image::ConstPointer input = dynamic_cast(referenceData->GetData()); - if (input.IsNull()) - return; - - const auto timePoint = mitk::RenderingManager::GetInstance()->GetTimeNavigationController()->GetSelectedTimePoint(); - input = GetImageByTimePoint(input, timePoint); - - if (nullptr == input) - { - MITK_WARN << "Cannot run segementation. Currently selected timepoint is not in the time bounds of the selected reference image. Time point: " << timePoint; - return; - } - - mitk::Image::Pointer output; + mitk::LabelSetImage::Pointer labelSetOutput; try { + mitk::Image::Pointer output; + bool inputChanged = inputAtTimeStep != m_LastFilterInput; // create and run itk filter pipeline - AccessByItk_1(input.GetPointer(), ITKWatershed, output); + AccessByItk_2(inputAtTimeStep, ITKWatershed, output, inputChanged); - mitk::LabelSetImage::Pointer labelSetOutput = mitk::LabelSetImage::New(); + labelSetOutput = mitk::LabelSetImage::New(); labelSetOutput->InitializeByLabeledImage(output); - - // create a new datanode for output - mitk::DataNode::Pointer dataNode = mitk::DataNode::New(); - dataNode->SetData(labelSetOutput); - - // set name of data node - std::string name = referenceData->GetName() + "_Watershed"; - dataNode->SetName(name); - - // look, if there is already a node with this name - mitk::DataStorage::SetOfObjects::ConstPointer children = - m_ToolManager->GetDataStorage()->GetDerivations(referenceData); - mitk::DataStorage::SetOfObjects::ConstIterator currentNode = children->Begin(); - mitk::DataNode::Pointer removeNode; - while (currentNode != children->End()) - { - if (dataNode->GetName().compare(currentNode->Value()->GetName()) == 0) - { - removeNode = currentNode->Value(); - } - currentNode++; - } - // remove node with same name - if (removeNode.IsNotNull()) - m_ToolManager->GetDataStorage()->Remove(removeNode); - - // add output to the data storage - m_ToolManager->GetDataStorage()->Add(dataNode, referenceData); } - catch (itk::ExceptionObject &e) + catch (itk::ExceptionObject & e) { MITK_ERROR << "Watershed Filter Error: " << e.GetDescription(); } + + m_LastFilterInput = inputAtTimeStep; - RenderingManager::GetInstance()->RequestUpdateAll(); + return labelSetOutput; } template -void mitk::WatershedTool::ITKWatershed(const itk::Image *originalImage, - mitk::Image::Pointer &segmentation) +void mitk::WatershedTool::ITKWatershed(const itk::Image* originalImage, + mitk::Image::Pointer& segmentation, bool inputChanged) { typedef itk::WatershedImageFilter> WatershedFilter; typedef itk::GradientMagnitudeRecursiveGaussianImageFilter, - itk::Image> + itk::Image> MagnitudeFilter; + // We create the filter pipeline only once (if needed) and not everytime we + // generate the ml image preview. + // Reason: If only the levels are changed the update of the pipe line is very + // fast and we want to profit from this feature. + // at first add a gradient magnitude filter - typename MagnitudeFilter::Pointer magnitude = MagnitudeFilter::New(); - magnitude->SetInput(originalImage); - magnitude->SetSigma(1.0); + typename MagnitudeFilter::Pointer magnitude = dynamic_cast(m_MagFilter.GetPointer()); + if (magnitude.IsNull()) + { + magnitude = MagnitudeFilter::New(); + magnitude->SetSigma(1.0); + magnitude->AddObserver(itk::ProgressEvent(), m_ProgressCommand); + m_MagFilter = magnitude.GetPointer(); + } - // use the progress bar - mitk::ToolCommand::Pointer command = mitk::ToolCommand::New(); - command->AddStepsToDo(60); + if (inputChanged) + { + magnitude->SetInput(originalImage); + } // then add the watershed filter to the pipeline - typename WatershedFilter::Pointer watershed = WatershedFilter::New(); - watershed->SetInput(magnitude->GetOutput()); + typename WatershedFilter::Pointer watershed = dynamic_cast(m_WatershedFilter.GetPointer()); + if (watershed.IsNull()) + { + watershed = WatershedFilter::New(); + watershed->SetInput(magnitude->GetOutput()); + watershed->AddObserver(itk::ProgressEvent(), m_ProgressCommand); + m_WatershedFilter = watershed.GetPointer(); + } + watershed->SetThreshold(m_Threshold); watershed->SetLevel(m_Level); - watershed->AddObserver(itk::ProgressEvent(), command); watershed->Update(); // then make sure, that the output has the desired pixel type typedef itk::CastImageFilter> + itk::Image> CastFilter; typename CastFilter::Pointer cast = CastFilter::New(); cast->SetInput(watershed->GetOutput()); // start the whole pipeline cast->Update(); - // reset the progress bar by setting progress - command->SetProgress(10); - // since we obtain a new image from our pipeline, we have to make sure, that our mitk::Image::Pointer // is responsible for the memory management of the output image segmentation = mitk::GrabItkImageMemory(cast->GetOutput()); } diff --git a/Modules/Segmentation/Interactions/mitkWatershedTool.h b/Modules/Segmentation/Interactions/mitkWatershedTool.h index f50734141b..a4bea005ec 100644 --- a/Modules/Segmentation/Interactions/mitkWatershedTool.h +++ b/Modules/Segmentation/Interactions/mitkWatershedTool.h @@ -1,88 +1,84 @@ /*============================================================================ 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 mitkWatershedTool_h_Included #define mitkWatershedTool_h_Included -#include "mitkAutoSegmentationTool.h" +#include "mitkAutoMLSegmentationWithPreviewTool.h" #include "mitkCommon.h" #include -#include namespace us { class ModuleResource; } namespace mitk { - class Image; - /** \brief Simple watershed segmentation tool. \ingroup Interaction \ingroup ToolManagerEtAl Wraps ITK Watershed Filter into tool concept of MITK. For more information look into ITK documentation. \warning Only to be instantiated by mitk::ToolManager. - - $Darth Vader$ */ - class MITKSEGMENTATION_EXPORT WatershedTool : public AutoSegmentationTool + class MITKSEGMENTATION_EXPORT WatershedTool : public AutoMLSegmentationWithPreviewTool { public: - mitkClassMacro(WatershedTool, AutoSegmentationTool); + mitkClassMacro(WatershedTool, AutoMLSegmentationWithPreviewTool); itkFactorylessNewMacro(Self); itkCloneMacro(Self); - void SetThreshold(double t) - { - m_Threshold = t; - } + const char** GetXPM() const override; + const char* GetName() const override; + us::ModuleResource GetIconResource() const override; + + void Activated() override; + + itkSetMacro(Threshold, double); + itkGetConstMacro(Threshold, double); + + itkSetMacro(Level, double); + itkGetConstMacro(Level, double); + + protected: + WatershedTool() = default; + ~WatershedTool() = default; + + LabelSetImage::Pointer ComputeMLPreview(const Image* inputAtTimeStep, TimeStepType timeStep) override; - void SetLevel(double l) { m_Level = l; } - /** \brief Grabs the tool reference data and creates an ITK pipeline consisting of a GradientMagnitude - * image filter followed by a Watershed image filter. The output of the filter pipeline is then added - * to the data storage. */ - void DoIt(); + /** \brief Threshold parameter of the ITK Watershed Image Filter. See ITK Documentation for more information. */ + double m_Threshold = 0.0; + /** \brief Threshold parameter of the ITK Watershed Image Filter. See ITK Documentation for more information. */ + double m_Level = 0.0; +private: /** \brief Creates and runs an ITK filter pipeline consisting of the filters: GradientMagnitude-, Watershed- and * CastImageFilter. * * \param originalImage The input image, which is delivered by the AccessByItk macro. * \param segmentation A pointer to the output image, which will point to the pipeline output after execution. */ template - void ITKWatershed(const itk::Image *originalImage, itk::SmartPointer &segmentation); - - const char **GetXPM() const override; - const char *GetName() const override; - us::ModuleResource GetIconResource() const override; - - protected: - WatershedTool(); // purposely hidden - ~WatershedTool() override; - - void Activated() override; - void Deactivated() override; + void ITKWatershed(const itk::Image* originalImage, itk::SmartPointer& segmentation, bool inputChanged); - /** \brief Threshold parameter of the ITK Watershed Image Filter. See ITK Documentation for more information. */ - double m_Threshold; - /** \brief Threshold parameter of the ITK Watershed Image Filter. See ITK Documentation for more information. */ - double m_Level; + itk::ProcessObject::Pointer m_MagFilter; + itk::ProcessObject::Pointer m_WatershedFilter; + mitk::Image::ConstPointer m_LastFilterInput; }; } // namespace #endif diff --git a/Modules/SegmentationUI/Qmitk/QmitkWatershedToolGUI.cpp b/Modules/SegmentationUI/Qmitk/QmitkWatershedToolGUI.cpp index a6f7763f5c..e76d08f4d9 100644 --- a/Modules/SegmentationUI/Qmitk/QmitkWatershedToolGUI.cpp +++ b/Modules/SegmentationUI/Qmitk/QmitkWatershedToolGUI.cpp @@ -1,150 +1,197 @@ /*============================================================================ 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 "QmitkWatershedToolGUI.h" -#include "QmitkNewSegmentationDialog.h" -#include "mitkProgressBar.h" - -#include -#include -#include -#include -#include -#include +#include MITK_TOOL_GUI_MACRO(MITKSEGMENTATIONUI_EXPORT, QmitkWatershedToolGUI, "") -QmitkWatershedToolGUI::QmitkWatershedToolGUI() : QmitkToolGUI(), m_SliderThreshold(nullptr), m_SliderLevel(nullptr) +QmitkWatershedToolGUI::QmitkWatershedToolGUI() : QmitkToolGUI() { - // create the visible widgets - QGridLayout *layout = new QGridLayout(this); - this->setContentsMargins(0, 0, 0, 0); - - QLabel *label = new QLabel("Threshold ", this); - QFont f = label->font(); - f.setBold(false); - label->setFont(f); - layout->addWidget(label, 0, 0); - - QLabel *label2 = new QLabel("Level ", this); - f = label2->font(); - f.setBold(false); - label2->setFont(f); - layout->addWidget(label2, 2, 0); - - m_ThresholdLabel = new QLabel(" 0.04", this); - f = m_ThresholdLabel->font(); - f.setBold(false); - m_ThresholdLabel->setFont(f); - layout->addWidget(m_ThresholdLabel, 0, 1); - - m_SliderThreshold = new QSlider(Qt::Horizontal, this); - m_SliderThreshold->setMinimum(0); - m_SliderThreshold->setMaximum(100); - m_SliderThreshold->setPageStep(1); - m_SliderThreshold->setValue(4); - connect(m_SliderThreshold, SIGNAL(valueChanged(int)), this, SLOT(OnSliderValueThresholdChanged(int))); - layout->addWidget(m_SliderThreshold, 1, 0, 1, 2); - - m_LevelLabel = new QLabel(" 0.35", this); - f = m_LevelLabel->font(); - f.setBold(false); - m_LevelLabel->setFont(f); - layout->addWidget(m_LevelLabel, 2, 1); - - m_SliderLevel = new QSlider(Qt::Horizontal, this); - m_SliderLevel->setMinimum(0); - m_SliderLevel->setMaximum(100); - m_SliderLevel->setPageStep(1); - m_SliderLevel->setValue(35); - connect(m_SliderLevel, SIGNAL(valueChanged(int)), this, SLOT(OnSliderValueLevelChanged(int))); - layout->addWidget(m_SliderLevel, 3, 0, 1, 2); - - QPushButton *okButton = new QPushButton("Run Segmentation", this); - connect(okButton, SIGNAL(clicked()), this, SLOT(OnCreateSegmentation())); - okButton->setFont(f); - layout->addWidget(okButton, 4, 0, 1, 2); - - m_InformationLabel = new QLabel("", this); - f = m_InformationLabel->font(); - f.setBold(false); - m_InformationLabel->setFont(f); - layout->addWidget(m_InformationLabel, 5, 0, 1, 2); - + m_Controls.setupUi(this); + + m_Controls.thresholdSlider->setMinimum(0); + m_Controls.thresholdSlider->setMaximum(1); + m_Controls.thresholdSlider->setValue(m_Threshold); + m_Controls.thresholdSlider->setPageStep(0.01); + m_Controls.thresholdSlider->setSingleStep(0.001); + m_Controls.thresholdSlider->setDecimals(4); + + m_Controls.levelSlider->setMinimum(0); + m_Controls.levelSlider->setMaximum(1); + m_Controls.levelSlider->setValue(m_Level); + m_Controls.levelSlider->setPageStep(0.1); + m_Controls.levelSlider->setSingleStep(0.01); + + connect(m_Controls.previewButton, SIGNAL(clicked()), this, SLOT(OnSettingsAccept())); + connect(m_Controls.m_selectionListWidget, &QmitkSimpleLabelSetListWidget::SelectedLabelsChanged, this, &QmitkWatershedToolGUI::OnRegionSelectionChanged); + connect(m_Controls.levelSlider, SIGNAL(valueChanged(double)), this, SLOT(OnLevelChanged(double))); + connect(m_Controls.thresholdSlider, SIGNAL(valueChanged(double)), this, SLOT(OnThresholdChanged(double))); + connect(m_Controls.m_ConfSegButton, SIGNAL(clicked()), this, SLOT(OnSegmentationRegionAccept())); connect(this, SIGNAL(NewToolAssociated(mitk::Tool *)), this, SLOT(OnNewToolAssociated(mitk::Tool *))); } QmitkWatershedToolGUI::~QmitkWatershedToolGUI() { if (m_WatershedTool.IsNotNull()) { - // m_WatershedTool->SizeChanged -= mitk::MessageDelegate1( this, - // &QmitkWatershedToolGUI::OnSizeChanged ); + m_WatershedTool->CurrentlyBusy -= + mitk::MessageDelegate1(this, &QmitkWatershedToolGUI::BusyStateChanged); + } +} + +void QmitkWatershedToolGUI::OnRegionSelectionChanged(const QmitkSimpleLabelSetListWidget::LabelVectorType& selectedLabels) +{ + if (m_WatershedTool.IsNotNull()) + { + mitk::AutoMLSegmentationWithPreviewTool::SelectedLabelVectorType labelIDs; + for (const auto& label : selectedLabels) + { + labelIDs.push_back(label->GetValue()); + } + + m_WatershedTool->SetSelectedLabels(labelIDs); + m_WatershedTool->UpdatePreview(); + + m_Controls.m_ConfSegButton->setEnabled(!labelIDs.empty()); } } void QmitkWatershedToolGUI::OnNewToolAssociated(mitk::Tool *tool) { if (m_WatershedTool.IsNotNull()) { - // m_WatershedTool->SizeChanged -= mitk::MessageDelegate1( this, - // &QmitkWatershedToolGUI::OnSizeChanged ); + m_WatershedTool->CurrentlyBusy -= + mitk::MessageDelegate1(this, &QmitkWatershedToolGUI::BusyStateChanged); } m_WatershedTool = dynamic_cast(tool); - OnSliderValueLevelChanged(35); - OnSliderValueThresholdChanged(4); if (m_WatershedTool.IsNotNull()) { - // m_WatershedTool->SizeChanged += mitk::MessageDelegate1( this, - // &QmitkWatershedToolGUI::OnSizeChanged ); + m_WatershedTool->CurrentlyBusy += + mitk::MessageDelegate1(this, &QmitkWatershedToolGUI::BusyStateChanged); + + m_WatershedTool->SetLevel(m_Level); + m_WatershedTool->SetThreshold(m_Threshold); + + m_WatershedTool->SetOverwriteExistingSegmentation(true); + m_WatershedTool->IsTimePointChangeAwareOff(); + m_Controls.m_CheckProcessAll->setVisible(m_WatershedTool->GetTargetSegmentationNode()->GetData()->GetTimeSteps() > 1); } } -void QmitkWatershedToolGUI::OnSliderValueThresholdChanged(int value) +void QmitkWatershedToolGUI::OnSegmentationRegionAccept() { + QString segName = QString::fromStdString(m_WatershedTool->GetCurrentSegmentationName()); + if (m_WatershedTool.IsNotNull()) { - double realValue = value / 100.; - m_WatershedTool->SetThreshold(realValue); - m_ThresholdLabel->setText(QString::number(realValue)); + if (this->m_Controls.m_CheckCreateNew->isChecked()) + { + m_WatershedTool->SetOverwriteExistingSegmentation(false); + } + else + { + m_WatershedTool->SetOverwriteExistingSegmentation(true); + } + + m_WatershedTool->SetCreateAllTimeSteps(this->m_Controls.m_CheckProcessAll->isChecked()); + + this->m_Controls.m_ConfSegButton->setEnabled(false); + m_WatershedTool->ConfirmSegmentation(); } } -void QmitkWatershedToolGUI::OnSliderValueLevelChanged(int value) +void QmitkWatershedToolGUI::OnSettingsAccept() { if (m_WatershedTool.IsNotNull()) { - double realValue = value / 100.; - m_WatershedTool->SetLevel(realValue); - m_LevelLabel->setText(QString::number(realValue)); + try + { + m_Threshold = m_Controls.thresholdSlider->value(); + m_Level = m_Controls.levelSlider->value(); + m_WatershedTool->SetThreshold(m_Threshold); + m_WatershedTool->SetLevel(m_Level); + + m_WatershedTool->UpdatePreview(); + } + catch (const std::exception& e) + { + this->setCursor(Qt::ArrowCursor); + std::stringstream stream; + stream << "Error while generation watershed segmentation. Reason: " << e.what(); + + QMessageBox* messageBox = + new QMessageBox(QMessageBox::Critical, + nullptr, stream.str().c_str()); + messageBox->exec(); + delete messageBox; + MITK_ERROR << stream.str(); + return; + } + catch (...) + { + this->setCursor(Qt::ArrowCursor); + std::stringstream stream; + stream << "Unkown error occured while generation watershed segmentation."; + + QMessageBox* messageBox = + new QMessageBox(QMessageBox::Critical, + nullptr, stream.str().c_str()); + messageBox->exec(); + delete messageBox; + MITK_ERROR << stream.str(); + return; + } + + m_Controls.m_selectionListWidget->SetLabelSetImage(m_WatershedTool->GetMLPreview()); + m_WatershedTool->IsTimePointChangeAwareOn(); } } -void QmitkWatershedToolGUI::OnCreateSegmentation() +void QmitkWatershedToolGUI::BusyStateChanged(bool value) { - QApplication::setOverrideCursor(Qt::BusyCursor); - m_InformationLabel->setText(QString("Please wait some time for computation...")); - m_InformationLabel->repaint(); - QApplication::processEvents(); + if (value) + { + QApplication::setOverrideCursor(QCursor(Qt::BusyCursor)); + } + else + { + QApplication::restoreOverrideCursor(); + } - m_WatershedTool->DoIt(); - m_InformationLabel->setText(QString("")); - QApplication::setOverrideCursor(Qt::ArrowCursor); + m_Controls.levelSlider->setEnabled(!value); + m_Controls.thresholdSlider->setEnabled(!value); + m_Controls.m_ConfSegButton->setEnabled(!m_WatershedTool->GetSelectedLabels().empty() && !value); + m_Controls.m_CheckProcessAll->setEnabled(!value); + m_Controls.m_CheckCreateNew->setEnabled(!value); + m_Controls.previewButton->setEnabled(!value); +} - for (int i = 0; i < 60; ++i) + +void QmitkWatershedToolGUI::OnLevelChanged(double value) +{ + if (m_WatershedTool.IsNotNull()) + { + m_WatershedTool->SetLevel(value); + } +} + +void QmitkWatershedToolGUI::OnThresholdChanged(double value) +{ + if (m_WatershedTool.IsNotNull()) { - mitk::ProgressBar::GetInstance()->Progress(); + m_WatershedTool->SetThreshold(value); } } diff --git a/Modules/SegmentationUI/Qmitk/QmitkWatershedToolGUI.h b/Modules/SegmentationUI/Qmitk/QmitkWatershedToolGUI.h index 23c40cab24..ba77d42076 100644 --- a/Modules/SegmentationUI/Qmitk/QmitkWatershedToolGUI.h +++ b/Modules/SegmentationUI/Qmitk/QmitkWatershedToolGUI.h @@ -1,72 +1,67 @@ /*============================================================================ 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 QmitkWatershedToolGUI_h_Included #define QmitkWatershedToolGUI_h_Included #include "QmitkToolGUI.h" #include "mitkWatershedTool.h" -#include -class QSlider; -class QLabel; -class QFrame; +#include "ui_QmitkWatershedToolGUIControls.h" + +#include /** \ingroup org_mitk_gui_qt_interactivesegmentation_internal \brief GUI for mitk::WatershedTool. \sa mitk::WatershedTool This GUI shows two sliders to change the watershed parameters. It executes the watershed algorithm by clicking on the button. */ class MITKSEGMENTATIONUI_EXPORT QmitkWatershedToolGUI : public QmitkToolGUI { Q_OBJECT public: mitkClassMacro(QmitkWatershedToolGUI, QmitkToolGUI); itkFactorylessNewMacro(Self); itkCloneMacro(Self); - protected slots : +protected slots : + + void OnNewToolAssociated(mitk::Tool *); - void OnNewToolAssociated(mitk::Tool *); + void OnSettingsAccept(); - /** \brief Passes the chosen threshold value directly to the watershed tool */ - void OnSliderValueThresholdChanged(int value); - /** \brief Passes the chosen level value directly to the watershed tool */ - void OnSliderValueLevelChanged(int value); - /** \brief Starts segmentation algorithm in the watershed tool */ - void OnCreateSegmentation(); + void OnSegmentationRegionAccept(); + + void OnRegionSelectionChanged(const QmitkSimpleLabelSetListWidget::LabelVectorType& selectedLabels); + + void OnLevelChanged(double value); + void OnThresholdChanged(double value); protected: QmitkWatershedToolGUI(); ~QmitkWatershedToolGUI() override; - QSlider *m_SliderThreshold; - QSlider *m_SliderLevel; - - /** \brief Label showing the current threshold value. */ - QLabel *m_ThresholdLabel; - /** \brief Label showing the current level value. */ - QLabel *m_LevelLabel; - /** \brief Label showing additional informations. */ - QLabel *m_InformationLabel; - - QFrame *m_Frame; + void BusyStateChanged(bool value) override; + + double m_Level = 0.4; + double m_Threshold = 0.004; + Ui_QmitkWatershedToolGUIControls m_Controls; mitk::WatershedTool::Pointer m_WatershedTool; }; #endif