Medical Imaging Interaction Toolkit  2025.08.99-f7084adb
Medical Imaging Interaction Toolkit
QmitkSegmentAnythingToolGUI.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 QmitkSegmentAnythingToolGUI_h
14 #define QmitkSegmentAnythingToolGUI_h
15 
18 #include "ui_QmitkSegmentAnythingGUIControls.h"
19 #include "QmitknnUNetGPU.h"
21 #include <QMessageBox>
22 #include <QStandardPaths>
23 #include <mitkIPreferences.h>
24 
30 {
31  Q_OBJECT
32 
33 public:
35  itkFactorylessNewMacro(Self);
36  itkCloneMacro(Self);
37 
38 protected slots:
42  void OnResetPicksClicked();
43 
47  void OnActivateBtnClicked();
48 
49 protected:
52 
53  void InitializeUI(QBoxLayout *mainLayout) override;
54 
58  void WriteStatusMessage(const QString&);
59 
63  void WriteErrorMessage(const QString&);
64 
68  void StatusMessageListener(const std::string&);
69 
73  void OnPreferenceChangedEvent(const mitk::IPreferences::ChangeEvent&);
74 
78  void ShowErrorMessage(const std::string&, QMessageBox::Icon = QMessageBox::Critical);
79 
84  void EnableAll(bool);
85 
90  void ShowProgressBar(bool);
91 
98  bool ActivateSAMDaemon();
99 
105  bool ValidatePrefences();
106 
111  void UpdateSAMStatusMessage(QString &initText);
112 
113 private:
114  mitk::IPreferences* m_Preferences;
115  Ui_QmitkSegmentAnythingGUIControls m_Controls;
116  QmitkGPULoader m_GpuLoader;
117  bool m_FirstPreviewComputation = true;
118  const std::string WARNING_SAM_NOT_FOUND =
119  "SAM is not detected in the selected python environment. Please reinstall SAM.";
120 };
121 #endif
MITKSEGMENTATIONUI_EXPORT
#define MITKSEGMENTATIONUI_EXPORT
Definition: MitkSegmentationUIExports.h:15
QmitkSegWithPreviewToolGUIBase
GUI base clase for tools derived from mitk::SegWithPreviewTool.
Definition: QmitkSegWithPreviewToolGUIBase.h:30
QmitkSegWithPreviewToolGUIBase::mitkClassMacro
mitkClassMacro(QmitkSegWithPreviewToolGUIBase, QmitkToolGUI)
mitk::IPreferences::ChangeEvent
Event object sent on IPreferences::OnPropertyChanged events.
Definition: mitkIPreferences.h:56
QmitkSegWithPreviewToolGUIBase.h
QmitknnUNetGPU.h
QmitkGPULoader
Class to load and save GPU information for further validation.
Definition: QmitknnUNetGPU.h:35
QmitkSetupVirtualEnvUtil.h
QmitkSegWithPreviewToolGUIBase::InitializeUI
virtual void InitializeUI(QBoxLayout *mainLayout)
MitkSegmentationUIExports.h
mitkIPreferences.h
mitk::IPreferences
Interface to application preferences.
Definition: mitkIPreferences.h:50
QmitkSegmentAnythingToolGUI
GUI for mitk::SegmentAnythingTool.
Definition: QmitkSegmentAnythingToolGUI.h:29