Medical Imaging Interaction Toolkit  2024.06.99-692c34ce
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:
36  ~QmitkTotalSegmentatorPreferencePage() override = default;
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 
65  void AutoParsePythonPaths();
66 
72  void SetDeviceInfo();
73 
77  void UpdateStatusLabel();
78 
85  QString GetPythonPathFromUI(const QString &pyUI) const;
86 
93  bool IsTotalSegmentatorInstalled(const QString &pythonPath);
94 
98  int FetchSelectedDeviceFromUI() const;
99 
100  void UpdateTotalSegPreferencePath();
101 
102  Ui::QmitkTotalSegmentatorPreferencePage *m_Ui;
103  QWidget *m_Control;
104  QString m_SysPythonPath;
105  bool m_IsInstalled; // manual installed or not
107  QmitkGPULoader m_DeviceLoader;
108  static const QString WARNING_TOTALSEG_NOT_FOUND;
109  mitk::IPreferences *m_Preferences;
110 
111 protected slots:
112 
116  void OnPythonPathChanged(const QString &pyEnv);
117 
121  std::pair<QString, QString> OnSystemPythonChanged(const QString &pyEnv);
122 
126  void OnOverrideBoxChecked(int state);
127 
131  void OnClearButtonClicked();
132 
136  void OnInstallButtonClicked();
137 };
138 
139 #endif
QmitkTotalSegmentatorPreferencePage::OnClearButtonClicked
void OnClearButtonClicked()
Qt Slot.
QmitkTotalSegmentatorToolInstaller
Definition: QmitkTotalSegmentatorToolInstaller.h:18
QmitkTotalSegmentatorPreferencePage::Init
void Init(berry::IWorkbench::Pointer workbench) override
QmitkTotalSegmentatorPreferencePage::Update
void Update() override
QmitkTotalSegmentatorPreferencePage::PerformCancel
void PerformCancel() override
QmitkTotalSegmentatorPreferencePage::OnSystemPythonChanged
std::pair< QString, QString > OnSystemPythonChanged(const QString &pyEnv)
Qt Slot.
QmitkTotalSegmentatorPreferencePage::QmitkTotalSegmentatorPreferencePage
QmitkTotalSegmentatorPreferencePage()
QmitknnUNetGPU.h
QmitkGPULoader
Class to load and save GPU information for further validation.
Definition: QmitknnUNetGPU.h:35
berry::SmartPointer
Implements transparent reference counting.
Definition: berryICommandCategoryListener.h:21
QmitkTotalSegmentatorPreferencePage::CreateQtControl
void CreateQtControl(QWidget *parent) override
QmitkTotalSegmentatorPreferencePage::PerformOk
bool PerformOk() override
QmitkTotalSegmentatorPreferencePage
Definition: QmitkTotalSegmentatorPreferencePage.h:29
berry::IQtPreferencePage
Definition: berryIQtPreferencePage.h:29
QmitkTotalSegmentatorPreferencePage::GetQtControl
QWidget * GetQtControl() const override
Ui
Definition: BlueBerryExampleLauncherDialog.h:21
QmitkTotalSegmentatorToolInstaller.h
berryIQtPreferencePage.h
QmitkTotalSegmentatorPreferencePage::OnPythonPathChanged
void OnPythonPathChanged(const QString &pyEnv)
Qt Slot.
QmitkTotalSegmentatorPreferencePage::~QmitkTotalSegmentatorPreferencePage
~QmitkTotalSegmentatorPreferencePage() override=default
berry::IPreferencePage
Definition: berryIPreferencePage.h:42
mitkIPreferences.h
mitk::IPreferences
Interface to application preferences.
Definition: mitkIPreferences.h:50
QmitkToolInstallDialog.h
QmitkTotalSegmentatorPreferencePage::OnInstallButtonClicked
void OnInstallButtonClicked()
Qt Slot.
QmitkTotalSegmentatorPreferencePage::OnOverrideBoxChecked
void OnOverrideBoxChecked(int state)
Qt Slot.