13 #ifndef QmitknnUNetToolGUI_h
14 #define QmitknnUNetToolGUI_h
22 #include "ui_QmitknnUNetToolGUIControls.h"
25 #include <QMessageBox>
30 #include <boost/functional/hash.hpp>
31 #include <unordered_map>
42 boost::hash_combine(hashCode, request.generateHash());
54 itkFactorylessNewMacro(Self);
57 QCache<size_t, nnUNetCache>
m_Cache;
63 std::unordered_map<std::string, mitk::ProcessExecutor::Pointer>
m_Processes;
71 void OnPreviewRequested();
77 void OnDirectoryChanged(
const QString&);
83 void OnModelChanged(
const QString&);
89 void OnTaskChanged(
const QString &);
95 void OnTrainerChanged(
const QString&);
101 void OnCheckBoxChanged(
int);
108 void SegmentationProcessFailed();
114 void SegmentationResultHandler(
mitk::nnUNetTool *,
bool forceRender =
false);
120 void OnModalitiesNumberChanged(
int);
126 void OnPythonPathChanged(
const QString&);
132 void OnRefreshPresssed();
138 void OnClearCachePressed();
144 void OnDownloadModel();
150 void OnDownloadWorkerExit(
bool,
const QString);
156 void OnStopDownload();
176 void SetComboBoxToNone(ctkCheckableComboBox*);
182 void FillAvailableModelsInfoFromJSON(
const QString&);
188 void ExportAvailableModelsAsJSON(
const QString&);
194 void ClearAllModalities();
200 void DisplayMultiModalInfoFromJSON(
const QString&);
206 void ClearAllModalLabels();
215 void DumpJSONfromPickle(
const QString&);
222 QString FetchResultsFolderFromEnv();
229 unsigned int FetchSelectedGPUFromUI();
248 void CheckAllInCheckableComboBox(ctkCheckableComboBox*);
256 std::pair<QStringList, QStringList> ExtractTrainerPlannerFromString(QStringList);
272 void ShowEnsembleLayout(
bool visible =
true);
277 void ShowErrorMessage(
const std::string&, QMessageBox::Icon = QMessageBox::Critical);
282 void WriteStatusMessage(
const QString&);
287 void WriteErrorMessage(
const QString&);
293 void AutoParsePythonPaths();
298 bool IsModelExists(
const QString&,
const QString&,
const QString&);
305 void ClearAllComboBoxes();
311 void DisableEverything();
318 bool IsNNUNetInstalled(
const QString&);
326 const QString&,
const QString&,
const QString&,
const QString&,
const std::vector<std::string>&);
333 std::vector<std::string> FetchSelectedFoldsFromUI(ctkCheckableComboBox*);
340 std::vector<mitk::Image::ConstPointer> FetchMultiModalImagesFromUI();
346 void UpdateCacheCountOnUI();
348 Ui_QmitknnUNetToolGUIControls m_Controls;
355 std::vector<QmitkSingleNodeSelectionWidget*> m_Modalities;
356 std::vector<QLabel*> m_ModalLabels;
358 std::vector<std::unique_ptr<QmitknnUNetTaskParamsUITemplate>> m_EnsembleParams;
362 QString m_PythonPath;
376 std::shared_ptr<QmitknnUNetFolderParser> m_ParentFolder =
nullptr;
382 const QStringList m_VALID_MODELS = {
"2d",
"3d_lowres",
"3d_fullres",
"3d_cascade_fullres",
"ensembles"};
384 const QString m_CACHE_COUNT_BASE_LABEL =
"Cached Items: ";
386 const QString m_MITK_EXPORT_JSON_FILENAME =
"mitk_export.json";
388 const QString m_AVAILABLE_MODELS_JSON_FILENAME =
"available_models.json";
390 const QString m_PICKLE_FILENAME =
"plans.pkl";
395 QSettings m_Settings;
397 bool m_IsResultsFolderValid =
false;
399 QThread* m_nnUNetThread;
402 bool m_FirstPreviewComputation =
true;
403 EnableConfirmSegBtnFunctionType m_SuperclassEnableConfirmSegBtnFnc;