Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
Medical Imaging Interaction Toolkit
QmitkMultiLabelManager.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 QmitkMultiLabelManager_h
14 #define QmitkMultiLabelManager_h
15 
17 
18 #include <mitkLabelSetImage.h>
19 #include <mitkDataNode.h>
20 #include <mitkNumericTypes.h>
22 
23 #include <QWidget>
24 
26 class QCompleter;
27 
28 namespace Ui
29 {
30  class QmitkMultiLabelManagerControls;
31 }
32 
33 namespace mitk
34 {
35  class DataStorage;
36 }
37 
39 {
40  Q_OBJECT
41 
42 public:
43  explicit QmitkMultiLabelManager(QWidget *parent = nullptr);
44  ~QmitkMultiLabelManager() override;
45 
46 
48 
52  LabelValueVectorType GetSelectedLabels() const;
53 
54  mitk::LabelSetImage* GetMultiLabelSegmentation() const;
55  mitk::DataNode* GetMultiLabelNode() const;
56 
57 Q_SIGNALS:
63  void CurrentSelectionChanged(const LabelValueVectorType& labels);
64 
72  void GoToLabel(mitk::LabelSetImage::LabelValueType label, const mitk::Point3D& point) const;
73 
82  void LabelRenameRequested(mitk::Label* label, bool rename, bool& canceled) const;
83 
84 public Q_SLOTS:
85 
91  void SetSelectedLabels(const LabelValueVectorType& selectedLabels);
92 
98  void SetSelectedLabel(mitk::LabelSetImage::LabelValueType selectedLabel);
99 
109  void SetMultiLabelSegmentation(mitk::LabelSetImage* segmentation);
110 
117  void SetMultiLabelNode(mitk::DataNode* node);
118 
119  void SetDataStorage(mitk::DataStorage *storage);
120 
121  void UpdateControls();
122 
123  virtual void setEnabled(bool enabled);
124 
125  QStringList &GetLabelStringList();
126 
127  void SetDefaultLabelNaming(bool defaultLabelNaming);
128 
129 private Q_SLOTS:
130 
131  // LabelSet dependent
132 
133  void OnRenameLabelShortcutActivated();
134 
135  // reaction to "returnPressed" signal from ...
136  void OnSearchLabel();
137  // reaction to the change of labels. If multiple labels are selected, it is ignored.
138  void OnSelectedLabelChanged(const LabelValueVectorType& labels);
139 
140  // LabelSetImage Dependent
141  void OnCreateDetailedSurface(bool);
142  void OnCreateSmoothedSurface(bool);
143  // reaction to the signal "createMask" from QmitkLabelSetTableWidget
144  void OnCreateMask(bool);
145  // reaction to the signal "createCroppedMask" from QmitkLabelSetTableWidget
146  void OnCreateCroppedMask(bool);
147 
148  void OnSavePreset();
149  void OnLoadPreset();
150 
151  void OnGoToLabel(mitk::LabelSetImage::LabelValueType label, const mitk::Point3D& position) const;
152  void OnLabelRenameRequested(mitk::Label* label, bool rename, bool& canceled) const;
153  void OnModelUpdated();
154  void OnSegmentationChanged();
155 
156 private:
157  enum TableColumns
158  {
159  NAME_COL = 0,
160  LOCKED_COL,
161  COLOR_COL,
162  VISIBLE_COL
163  };
164 
165  void WaitCursorOn();
166 
167  void WaitCursorOff();
168 
169  void RestoreOverrideCursor();
170 
171  void OnThreadedCalculationDone();
172 
173  void AddSegmentationObserver();
174  void RemoveSegmentationObserver();
175 
176  void OnLabelEvent(mitk::LabelSetImage::LabelValueType labelValue);
177  void OnGroupEvent(mitk::LabelSetImage::GroupIndexType groupIndex);
178 
179  Ui::QmitkMultiLabelManagerControls* m_Controls;
180 
181  QCompleter *m_Completer;
182 
183  QStringList m_OrganColors;
184 
185  QStringList m_LabelStringList;
186 
187  bool m_ProcessingManualSelection;
188 
189  mitk::DataStorage* m_DataStorage;
190 
191  mitk::ITKEventObserverGuard m_LabelAddedObserver;
192  mitk::ITKEventObserverGuard m_LabelModifiedObserver;
193  mitk::ITKEventObserverGuard m_LabelRemovedObserver;
194  mitk::ITKEventObserverGuard m_GroupAddedObserver;
195  mitk::ITKEventObserverGuard m_GroupModifiedObserver;
196  mitk::ITKEventObserverGuard m_GroupRemovedObserver;
197 };
198 
199 #endif
MITKSEGMENTATIONUI_EXPORT
#define MITKSEGMENTATIONUI_EXPORT
Definition: MitkSegmentationUIExports.h:15
mitk::ITKEventObserverGuard
Convenience class that helps to manage the lifetime of itk event observers.
Definition: mitkITKEventObserverGuard.h:55
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
Ui
Definition: BlueBerryExampleLauncherDialog.h:21
mitk::Label
A data structure describing a label.
Definition: mitkLabel.h:29
QmitkMultiLabelManager::LabelValueVectorType
mitk::LabelSetImage::LabelValueVectorType LabelValueVectorType
Definition: QmitkMultiLabelManager.h:47
mitk::Point< ScalarType, 3 >
QmitkMultiLabelManager
Definition: QmitkMultiLabelManager.h:38
mitkNumericTypes.h
mitk::DataStorage
Data management class that handles 'was created by' relations.
Definition: mitkDataStorage.h:43
mitkDataNode.h
QmitkDataStorageComboBox
Displays all or a subset (defined by a predicate) of nodes of the Data Storage.
Definition: QmitkDataStorageComboBox.h:38
MitkSegmentationUIExports.h
mitkITKEventObserverGuard.h
mitk::LabelSetImage::GroupIndexType
std::size_t GroupIndexType
Definition: mitkLabelSetImage.h:74
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
mitk::LabelSetImage::LabelValueVectorType
std::vector< LabelValueType > LabelValueVectorType
Definition: mitkLabelSetImage.h:78
mitk::LabelSetImage
LabelSetImage class for handling labels and layers in a segmentation session.
Definition: mitkLabelSetImage.h:43
mitk::LabelSetImage::LabelValueType
mitk::Label::PixelType LabelValueType
Definition: mitkLabelSetImage.h:75
mitkLabelSetImage.h