Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkSegWithPreviewToolGUIBase.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QmitkSegWithPreviewToolGUIBase_h
14 #define QmitkSegWithPreviewToolGUIBase_h
15 
16 #include <QmitkToolGUI.h>
17 
18 #include <mitkSegWithPreviewTool.h>
19 
21 
22 class QCheckBox;
23 class QPushButton;
24 class QBoxLayout;
25 class QSlider;
26 class QLabel;
27 
39 {
40  Q_OBJECT
41 
42 public:
44  itkCloneMacro(Self);
45 
46  itkGetConstMacro(Mode2D, bool);
47 
48 protected slots:
49 
51 
53 
54  void OnPreviewOpacityChanged(int value);
55 
56  void OnPreviewVisibilityToggled(bool checked);
57 
58 protected:
65  QmitkSegWithPreviewToolGUIBase(bool mode2D, bool enableProcessingOfAllTimeSteps = true);
67 
69  virtual void ConnectNewTool(mitk::SegWithPreviewTool* newTool);
70 
77  virtual void InitializeUI(QBoxLayout* mainLayout);
78 
79  void BusyStateChanged(bool isBusy) override;
80 
81  using EnableConfirmSegBtnFunctionType = std::function<bool(bool)>;
83 
89  virtual void EnableWidgets(bool enabled);
90 
91  template <class TTool>
93  {
94  return dynamic_cast<TTool*>(m_Tool.GetPointer());
95  };
96 
99 
100  QPushButton* GetConfirmSegmentationButton() const;
101 
102  QCheckBox* GetPreviewVisibilityCheckBox() const;
103  QLabel* GetPreviewLabel() const;
104 
105 private:
106  QCheckBox* m_CheckIgnoreLocks = nullptr;
107  QCheckBox* m_CheckMerge = nullptr;
108  QCheckBox* m_CheckProcessAll = nullptr;
109  QSlider* m_PreviewOpacitySlider = nullptr;
110  QCheckBox* m_PreviewVisibleCheckBox = nullptr;
111  QLabel* m_PreviewLabel = nullptr;
112  QPushButton* m_ConfirmSegBtn = nullptr;
113  QBoxLayout* m_MainLayout = nullptr;
114 
116  bool m_Mode2D;
117  bool m_EnableProcessingOfAllTimeSteps;
118 
119  mitk::SegWithPreviewTool::Pointer m_Tool;
120 };
121 
122 #endif
#define MITKSEGMENTATIONUI_EXPORT
GUI base class for tools derived from mitk::SegWithPreviewTool.
~QmitkSegWithPreviewToolGUIBase() override
QLabel * GetPreviewLabel() const
QCheckBox * GetPreviewVisibilityCheckBox() const
virtual void EnableWidgets(bool enabled)
std::function< bool(bool)> EnableConfirmSegBtnFunctionType
virtual void DisconnectOldTool(mitk::SegWithPreviewTool *oldTool)
void BusyStateChanged(bool isBusy) override
Called when the tool's busy state changes. Override to enable/disable UI elements.
QPushButton * GetConfirmSegmentationButton() const
void OnPreviewVisibilityToggled(bool checked)
void OnPreviewOpacityChanged(int value)
mitkClassMacro(QmitkSegWithPreviewToolGUIBase, QmitkToolGUI)
void SetOverwriteStyle(mitk::MultiLabelSegmentation::OverwriteStyle overwriteStyle)
virtual void InitializeUI(QBoxLayout *mainLayout)
QmitkSegWithPreviewToolGUIBase(bool mode2D, bool enableProcessingOfAllTimeSteps=true)
virtual void ConnectNewTool(mitk::SegWithPreviewTool *newTool)
void OnNewToolAssociated(mitk::Tool *)
void SetMergeStyle(mitk::MultiLabelSegmentation::MergeStyle mergeStyle)
EnableConfirmSegBtnFunctionType m_EnableConfirmSegBtnFnc
Base class for GUIs belonging to mitk::Tool classes.
Definition: QmitkToolGUI.h:32
mitk::Tool::Pointer m_Tool
Definition: QmitkToolGUI.h:70
Base class for any auto segmentation tool that provides a preview of the new segmentation.
Base class of all tools used by mitk::ToolManager.
Definition: mitkTool.h:80