/*============================================================================

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 QmitkGrowCutToolGUI_h
#define QmitkGrowCutToolGUI_h

#include <QmitkMultiLabelSegWithPreviewToolGUIBase.h>

#include <MitkSegmentationUIExports.h>
#include <memory>

namespace Ui
{
  class QmitkGrowCutToolWidgetControls;
}

/**
  \brief GUI for the GrowCut segmentation tool.

  Provides controls for the GrowCut algorithm including a preview button, advanced settings
  for the distance penalty parameter, and label selection for multi-label preview.

  \sa mitk::GrowCutTool
  \sa QmitkMultiLabelSegWithPreviewToolGUIBase
*/
class MITKSEGMENTATIONUI_EXPORT QmitkGrowCutToolGUI : public QmitkMultiLabelSegWithPreviewToolGUIBase
{
  Q_OBJECT

public:
  mitkClassMacro(QmitkGrowCutToolGUI, QmitkMultiLabelSegWithPreviewToolGUIBase);
  itkFactorylessNewMacro(Self);
  itkCloneMacro(Self);

protected slots:

  void OnPreviewBtnClicked();

private slots:

  void OnAdvancedSettingsButtonToggled(bool toggled);

protected:
  QmitkGrowCutToolGUI();
  ~QmitkGrowCutToolGUI() override;

  void ConnectNewTool(mitk::SegWithPreviewTool *newTool) override;

  void InitializeUI(QBoxLayout *mainLayout) override;

  void SetValueOfDistancePenaltySlider(double val);

  void SetValueOfDistancePenaltyDoubleSpinBox(int val);

  void EnableWidgets(bool enabled) override;

  std::unique_ptr<Ui::QmitkGrowCutToolWidgetControls> m_Controls;

  bool m_FirstPreviewComputation = false;
};

#endif
