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

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

#include <QmitkMultiLabelSegWithPreviewToolGUIBase.h>

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

namespace Ui
{
  class QmitkOtsuToolWidgetControls;
}

/**
  \brief GUI for mitk::OtsuTool3D providing controls for Otsu multi-threshold segmentation.

  Provides a spin box for the number of regions, a preview button, and advanced settings
  for adjusting the Otsu algorithm parameters.

  \sa mitk::OtsuTool3D
  \sa QmitkMultiLabelSegWithPreviewToolGUIBase
*/
class MITKSEGMENTATIONUI_EXPORT QmitkOtsuTool3DGUI : public QmitkMultiLabelSegWithPreviewToolGUIBase
{
  Q_OBJECT

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

protected slots :

  void OnPreviewBtnClicked();

  void OnRegionSpinboxChanged(int);

private slots:

  void OnAdvancedSettingsButtonToggled(bool toggled);

protected:
  QmitkOtsuTool3DGUI();
  ~QmitkOtsuTool3DGUI();

  void ConnectNewTool(mitk::SegWithPreviewTool* newTool) override;
  void InitializeUI(QBoxLayout* mainLayout) override;

  void EnableWidgets(bool enabled) override;

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

  bool m_FirstPreviewComputation = true;
  EnableConfirmSegBtnFunctionType m_SuperclassEnableConfirmSegBtnFnc;
};

#endif
