Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
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 
16 #include <mitkForm.h>
18 
20 
22 
23 #include <QWidget>
24 
25 #include <optional>
26 
27 class QFileSystemWatcher;
28 
29 namespace Ui
30 {
32 }
33 
35 {
36  Q_OBJECT
37 
38 public:
39  explicit QmitkSegmentationTaskListWidget(QWidget* parent = nullptr);
41 
42  void SetDataStorage(mitk::DataStorage* dataStorage);
43  void CheckDataStorage(const mitk::DataNode* removedNode = nullptr);
44 
45  bool ActiveTaskIsShown() const;
46  void LoadNextUnfinishedTask();
47  void SaveActiveTask(bool saveAsInterimResult = false);
48  bool OnPreShutdown();
49 
50 signals:
51  void ActiveTaskChanged(const std::optional<size_t>& index);
52  void CurrentTaskChanged(const std::optional<size_t>& index);
53 
54 private:
55  void OnSelectionChanged(const QmitkSingleNodeSelectionWidget::NodeList& nodes);
56  void ResetControls();
57  void SetTaskList(mitk::SegmentationTaskList* task);
58  void ResetFileSystemWatcher();
59  void OnResultDirectoryChanged(const QString&);
60  void UpdateProgressBar();
61  void OnTaskListChanged(mitk::SegmentationTaskList* task);
62  void OnPreviousButtonClicked();
63  void OnNextButtonClicked();
64  void OnFindButtonClicked();
65  void OnCurrentTaskChanged();
66  void UpdateLoadButton();
67  void UpdateNavigationButtons();
68  void UpdateDetailsLabel();
69  void UpdateFormWidget();
70  void OnFormSubmission();
71  void UpdateStoreAndAcceptButtons();
72  void OnLoadButtonClicked();
73  mitk::DataNode* GetImageDataNode(size_t index) const;
74  void UnloadTasks(const mitk::DataNode* skip = nullptr);
75  void LoadTask(mitk::DataNode::Pointer imageNode = nullptr);
76  void SubscribeToActiveSegmentation();
77  void UnsubscribeFromActiveSegmentation();
78  void OnSegmentationModified();
79  void SetActiveTaskIndex(const std::optional<size_t>& index);
80  void SetCurrentTaskIndex(const std::optional<size_t>& index);
81  bool HandleUnsavedChanges(const QString& alternativeTitle = QString());
82  void OnUnsavedChangesSaved();
83  void OnPreviousTaskShortcutActivated();
84  void OnNextTaskShortcutActivated();
85  void OnFindTaskShortcutActivated();
86  void OnLoadTaskShortcutActivated();
87  void OnStoreInterimResultShortcutActivated();
88  void OnAcceptSegmentationShortcutActivated();
89  void OnStoreButtonClicked();
90  void OnAcceptButtonClicked();
91 
92  Ui::QmitkSegmentationTaskListWidget* m_Ui;
93  QFileSystemWatcher* m_FileSystemWatcher;
94  mitk::DataStorage* m_DataStorage;
96  mitk::Forms::Form m_Form;
97  mitk::DataNode::Pointer m_TaskListNode;
98  mitk::DataNode* m_ImageNode;
99  mitk::DataNode* m_SegmentationNode;
100  std::optional<size_t> m_CurrentTaskIndex;
101  std::optional<size_t> m_ActiveTaskIndex;
102  std::optional<unsigned long> m_SegmentationModifiedObserverTag;
103  bool m_UnsavedChanges;
104 };
105 
106 #endif
MITKSEGMENTATIONUI_EXPORT
#define MITKSEGMENTATIONUI_EXPORT
Definition: MitkSegmentationUIExports.h:15
mitkForm.h
mitk::Forms::Form
Definition: mitkForm.h:36
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:34
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