Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
81  void LabelRenameRequested(mitk::Label* label, bool rename, bool& canceled) const;
82 
83 public Q_SLOTS:
84 
90  void SetSelectedLabels(const LabelValueVectorType& selectedLabels);
91 
97  void SetSelectedLabel(mitk::LabelSetImage::LabelValueType selectedLabel);
98 
108  void SetMultiLabelSegmentation(mitk::LabelSetImage* segmentation);
109 
116  void SetMultiLabelNode(mitk::DataNode* node);
117 
118  void SetDataStorage(mitk::DataStorage *storage);
119 
120  void UpdateControls();
121 
122  virtual void setEnabled(bool enabled);
123 
124  QStringList &GetLabelStringList();
125 
126  void SetDefaultLabelNaming(bool defaultLabelNaming);
127 
128 private Q_SLOTS:
129 
130  // LabelSet dependent
131 
132  void OnRenameLabelShortcutActivated();
133 
134  // reaction to "returnPressed" signal from ...
135  void OnSearchLabel();
136  // reaction to the change of labels. If multiple labels are selected, it is ignored.
137  void OnSelectedLabelChanged(const LabelValueVectorType& labels);
138 
139  // LabelSetImage Dependent
140  void OnCreateDetailedSurface(bool);
141  void OnCreateSmoothedSurface(bool);
142  // reaction to the signal "createMask" from QmitkLabelSetTableWidget
143  void OnCreateMask(bool);
144  // reaction to the signal "createCroppedMask" from QmitkLabelSetTableWidget
145  void OnCreateCroppedMask(bool);
146 
147  void OnSavePreset();
148  void OnLoadPreset();
149 
150  void OnGoToLabel(mitk::LabelSetImage::LabelValueType label, const mitk::Point3D& position) const;
151  void OnLabelRenameRequested(mitk::Label* label, bool rename, bool& canceled) const;
152  void OnModelUpdated();
153  void OnSegmentationChanged();
154 
155 private:
156  enum TableColumns
157  {
158  NAME_COL = 0,
159  LOCKED_COL,
160  COLOR_COL,
161  VISIBLE_COL
162  };
163 
164  void WaitCursorOn();
165 
166  void WaitCursorOff();
167 
168  void RestoreOverrideCursor();
169 
170  void OnThreadedCalculationDone();
171 
172  void AddSegmentationObserver();
173  void RemoveSegmentationObserver();
174 
175  void OnLabelEvent(mitk::LabelSetImage::LabelValueType labelValue);
176  void OnGroupEvent(mitk::LabelSetImage::GroupIndexType groupIndex);
177 
178  Ui::QmitkMultiLabelManagerControls* m_Controls;
179 
180  QCompleter *m_Completer;
181 
182  QStringList m_OrganColors;
183 
184  QStringList m_LabelStringList;
185 
186  bool m_ProcessingManualSelection;
187 
188  mitk::DataStorage* m_DataStorage;
189 
190  mitk::ITKEventObserverGuard m_LabelAddedObserver;
191  mitk::ITKEventObserverGuard m_LabelModifiedObserver;
192  mitk::ITKEventObserverGuard m_LabelRemovedObserver;
193  mitk::ITKEventObserverGuard m_GroupAddedObserver;
194  mitk::ITKEventObserverGuard m_GroupModifiedObserver;
195  mitk::ITKEventObserverGuard m_GroupRemovedObserver;
196 };
197 
198 #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