Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
QmitkSegmentationTaskListWidget.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 QmitkSegmentationTaskListWidget_h
14 #define QmitkSegmentationTaskListWidget_h
15 
17 
19 
21 
22 #include <QWidget>
23 
24 #include <optional>
25 
26 class QFileSystemWatcher;
27 
28 namespace Ui
29 {
31 }
32 
34 {
35  Q_OBJECT
36 
37 public:
38  explicit QmitkSegmentationTaskListWidget(QWidget* parent = nullptr);
40 
41  void SetDataStorage(mitk::DataStorage* dataStorage);
42  void CheckDataStorage(const mitk::DataNode* removedNode = nullptr);
43 
44  bool ActiveTaskIsShown() const;
45  void LoadNextUnfinishedTask();
46  void SaveActiveTask(bool saveAsIntermediateResult = false);
47  bool OnPreShutdown();
48 
49 signals:
50  void ActiveTaskChanged(const std::optional<size_t>& index);
51  void CurrentTaskChanged(const std::optional<size_t>& index);
52 
53 private:
54  void OnSelectionChanged(const QmitkSingleNodeSelectionWidget::NodeList& nodes);
55  void ResetControls();
56  void SetTaskList(mitk::SegmentationTaskList* task);
57  void ResetFileSystemWatcher();
58  void OnResultDirectoryChanged(const QString&);
59  void UpdateProgressBar();
60  void OnTaskListChanged(mitk::SegmentationTaskList* task);
61  void OnPreviousButtonClicked();
62  void OnNextButtonClicked();
63  void OnFindButtonClicked();
64  void OnCurrentTaskChanged();
65  void UpdateLoadButton();
66  void UpdateNavigationButtons();
67  void UpdateDetailsLabel();
68  void UpdateStoreAndAcceptButtons();
69  void OnLoadButtonClicked();
70  mitk::DataNode* GetImageDataNode(size_t index) const;
71  void UnloadTasks(const mitk::DataNode* skip = nullptr);
72  void LoadTask(mitk::DataNode::Pointer imageNode = nullptr);
73  void SubscribeToActiveSegmentation();
74  void UnsubscribeFromActiveSegmentation();
75  void OnSegmentationModified();
76  void SetActiveTaskIndex(const std::optional<size_t>& index);
77  void SetCurrentTaskIndex(const std::optional<size_t>& index);
78  bool HandleUnsavedChanges(const QString& alternativeTitle = QString());
79  mitk::DataNode* GetSegmentationDataNode(size_t index) const;
80  void OnUnsavedChangesSaved();
81  void OnPreviousTaskShortcutActivated();
82  void OnNextTaskShortcutActivated();
83  void OnFindTaskShortcutActivated();
84  void OnLoadTaskShortcutActivated();
85  void OnStoreInterimResultShortcutActivated();
86  void OnAcceptSegmentationShortcutActivated();
87  void OnStoreButtonClicked();
88  void OnAcceptButtonClicked();
89 
90  Ui::QmitkSegmentationTaskListWidget* m_Ui;
91  QFileSystemWatcher* m_FileSystemWatcher;
92  mitk::DataStorage* m_DataStorage;
94  mitk::DataNode::Pointer m_TaskListNode;
95  std::optional<size_t> m_CurrentTaskIndex;
96  std::optional<size_t> m_ActiveTaskIndex;
97  std::optional<unsigned long> m_SegmentationModifiedObserverTag;
98  bool m_UnsavedChanges;
99 };
100 
101 #endif
MITKSEGMENTATIONUI_EXPORT
#define MITKSEGMENTATIONUI_EXPORT
Definition: MitkSegmentationUIExports.h:15
mitk::SegmentationTaskList
A list of segmentation tasks.
Definition: mitkSegmentationTaskList.h:30
QmitkSingleNodeSelectionWidget.h
itk::SmartPointer< Self >
Ui
Definition: BlueBerryExampleLauncherDialog.h:21
mitkSegmentationTaskList.h
QmitkSegmentationTaskListWidget
Definition: QmitkSegmentationTaskListWidget.h:33
mitk::DataStorage
Data management class that handles 'was created by' relations.
Definition: mitkDataStorage.h:43
MitkSegmentationUIExports.h
QmitkSingleNodeSelectionWidget::NodeList
QmitkAbstractNodeSelectionWidget::NodeList NodeList
Definition: QmitkSingleNodeSelectionWidget.h:50
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63