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