Medical Imaging Interaction Toolkit  2025.12.02
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 
63 
68 
72  void ShowErrorMessage(const std::string &, QMessageBox::Icon = QMessageBox::Critical);
73 
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:
103 
108 
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
#define MITKSEGMENTATIONUI_EXPORT
Class to load and save GPU information for further validation.
GUI for mitk::MedSAMTool.
void OnPreviewBtnClicked()
Qt Slot.
bool ActivateSAMDaemon()
Requests the tool class to spawn the SAM python daemon process. Waits until the daemon is started.
void ShowErrorMessage(const std::string &, QMessageBox::Icon=QMessageBox::Critical)
Creates a QMessage object and shows on screen.
mitkClassMacro(QmitkMedSAMToolGUI, QmitkSegWithPreviewToolGUIBase)
void ShowProgressBar(bool)
Enable (or Disable) progressbar on GUI.
bool ValidatePrefences()
Checks if the preferences are correctly set by the user.
void EnableAll(bool)
Enable (or Disable) GUI elements. Currently, on the activate button is affected.
void StatusMessageListener(const std::string &)
Function to listen to tool class status emitters.
void WriteStatusMessage(const QString &)
Writes any message in white on the tool pane.
void OnActivateBtnClicked()
Qt Slot.
void UpdateMedSAMStatusMessage(QString &initText)
Checks if the preferences are correctly set and displays appropriate status message appending to the ...
void OnResetPicksClicked()
Qt Slot.
void OnPreferenceChangedEvent(const mitk::IPreferences::ChangeEvent &)
Function to listen to preference emitters.
void WriteErrorMessage(const QString &)
Writes any message in red on the tool pane.
void InitializeUI(QBoxLayout *mainLayout) override
GUI base clase for tools derived from mitk::SegWithPreviewTool.
Event object sent on IPreferences::OnPropertyChanged events.
Interface to application preferences.