Medical Imaging Interaction Toolkit  2025.12.02
Medical Imaging Interaction Toolkit
QmitkTotalSegmentatorPreferencePage.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 QmitkTotalSegmentatorPreferencePage_h
14 #define QmitkTotalSegmentatorPreferencePage_h
15 
16 #include <berryIQtPreferencePage.h>
17 #include "mitkIPreferences.h"
18 #include <ui_QmitkTotalSegmentatorPreferencePage.h>
20 #include <QMessageBox>
21 #include <QmitknnUNetGPU.h>
22 #include "QmitkToolInstallDialog.h"
23 
24 namespace Ui
25 {
27 }
28 
30 {
31  Q_OBJECT
32  Q_INTERFACES(berry::IPreferencePage)
33 
34 public:
37 
38  void Init(berry::IWorkbench::Pointer workbench) override;
39  void CreateQtControl(QWidget *parent) override;
40  QWidget *GetQtControl() const override;
41  bool PerformOk() override;
42  void PerformCancel() override;
43  void Update() override;
44 
45 private:
49  void ShowErrorMessage(const QString &, QMessageBox::Icon = QMessageBox::Critical);
50 
54  void WriteStatusMessage(const QString &);
55 
59  void WriteErrorMessage(const QString &message);
60 
66  void SetDeviceInfo();
67 
71  void UpdateStatusLabel();
72 
79  QString GetPythonPathFromUI(const QString &pyUI) const;
80 
87  bool IsTotalSegmentatorInstalled(const QString &pythonPath);
88 
92  int FetchSelectedDeviceFromUI() const;
93 
98  void AddOrRemoveLicense(const QString &licenseText);
99 
104  void UpdateLicenseBox();
105 
110  QString GetExactPythonPath();
111 
112  Ui::QmitkTotalSegmentatorPreferencePage *m_Ui;
113  QWidget *m_Control;
114  QString m_SysPythonPath;
115  bool m_IsInstalled; // manual installed or not
117  QmitkGPULoader m_DeviceLoader;
118  static const QString WARNING_TOTALSEG_NOT_FOUND;
119  static const QString WARNING_PYTHON_NOT_FOUND;
120  mitk::IPreferences *m_Preferences;
121  const int LICENSE_KEY_LENGTH = 18;
122 
123 protected slots:
124 
128  void OnPythonPathChanged(const QString &pyEnv);
129 
133  void OnSystemPythonChanged(const QString &pyEnv);
134 
138  void OnOverrideBoxChecked(int state);
139 
144 
149 
154 };
155 
156 #endif
Class to load and save GPU information for further validation.
void OnPythonPathChanged(const QString &pyEnv)
Qt Slot.
~QmitkTotalSegmentatorPreferencePage() override=default
void OnOverrideBoxChecked(int state)
Qt Slot.
void Init(berry::IWorkbench::Pointer workbench) override
QWidget * GetQtControl() const override
void CreateQtControl(QWidget *parent) override
void OnSystemPythonChanged(const QString &pyEnv)
Qt Slot.
Implements transparent reference counting.
Interface to application preferences.