Medical Imaging Interaction Toolkit  2025.08.99-f7084adb
Medical Imaging Interaction Toolkit
QmitkMedSAMToolGUI.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 QmitkMedSAMToolGUI_h
14 #define QmitkMedSAMToolGUI_h
15 
18 #include "ui_QmitkMedSAMGUIControls.h"
19 #include <mitkIPreferences.h>
20 #include "QmitknnUNetGPU.h"
21 
27 {
28  Q_OBJECT
29 
30 public:
32  itkFactorylessNewMacro(Self);
33  itkCloneMacro(Self);
34 
39  void EnableAll(bool);
40 
44  void WriteStatusMessage(const QString &);
45 
49  void WriteErrorMessage(const QString &);
50 
54  void ShowProgressBar(bool);
55 
62  bool ActivateSAMDaemon();
63 
67  void OnPreferenceChangedEvent(const mitk::IPreferences::ChangeEvent &);
68 
72  void ShowErrorMessage(const std::string &, QMessageBox::Icon = QMessageBox::Critical);
73 
79  bool ValidatePrefences();
80 
85  void UpdateMedSAMStatusMessage(QString &initText);
86 
87 protected:
90 
91  void InitializeUI(QBoxLayout *mainLayout) override;
92 
96  void StatusMessageListener(const std::string&);
97 
98 protected slots:
102  void OnActivateBtnClicked();
103 
107  void OnPreviewBtnClicked();
108 
112  void OnResetPicksClicked();
113 
114 private:
115  mitk::IPreferences *m_Preferences;
116  QmitkGPULoader m_GpuLoader;
117  Ui_QmitkMedSAMGUIControls m_Controls;
118  bool m_FirstPreviewComputation = true;
119  const std::string WARNING_SAM_NOT_FOUND =
120  "MedSAM is not detected in the selected python environment. Please reinstall MedSAM.";
121 };
122 #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
QmitknnUNetGPU.h
QmitkGPULoader
Class to load and save GPU information for further validation.
Definition: QmitknnUNetGPU.h:35
QmitkSegmentAnythingToolGUI.h
QmitkSegWithPreviewToolGUIBase::InitializeUI
virtual void InitializeUI(QBoxLayout *mainLayout)
MitkSegmentationUIExports.h
mitkIPreferences.h
QmitkMedSAMToolGUI
GUI for mitk::MedSAMTool.
Definition: QmitkMedSAMToolGUI.h:26
mitk::IPreferences
Interface to application preferences.
Definition: mitkIPreferences.h:50