Medical Imaging Interaction Toolkit  2023.04.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 OnCurrentTaskChanged();
64  void UpdateLoadButton();
65  void UpdateNavigationButtons();
66  void UpdateDetailsLabel();
67  void UpdateStoreAndAcceptButtons();
68  void OnLoadButtonClicked();
69  mitk::DataNode* GetImageDataNode(size_t index) const;
70  void UnloadTasks(const mitk::DataNode* skip = nullptr);
71  void LoadTask(mitk::DataNode::Pointer imageNode = nullptr);
72  void SubscribeToActiveSegmentation();
73  void UnsubscribeFromActiveSegmentation();
74  void OnSegmentationModified();
75  void SetActiveTaskIndex(const std::optional<size_t>& index);
76  void SetCurrentTaskIndex(const std::optional<size_t>& index);
77  bool HandleUnsavedChanges(const QString& alternativeTitle = QString());
78  mitk::DataNode* GetSegmentationDataNode(size_t index) const;
79  void OnUnsavedChangesSaved();
80  void OnPreviousTaskShortcutActivated();
81  void OnNextTaskShortcutActivated();
82  void OnLoadTaskShortcutActivated();
83  void OnStoreInterimResultShortcutActivated();
84  void OnAcceptSegmentationShortcutActivated();
85  void OnStoreButtonClicked();
86  void OnAcceptButtonClicked();
87 
88  Ui::QmitkSegmentationTaskListWidget* m_Ui;
89  QFileSystemWatcher* m_FileSystemWatcher;
90  mitk::DataStorage* m_DataStorage;
92  mitk::DataNode::Pointer m_TaskListNode;
93  std::optional<size_t> m_CurrentTaskIndex;
94  std::optional<size_t> m_ActiveTaskIndex;
95  std::optional<unsigned long> m_SegmentationModifiedObserverTag;
96  bool m_UnsavedChanges;
97 };
98 
99 #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