Medical Imaging Interaction Toolkit  2023.04.00
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>
21 
22 #include <QWidget>
23 
25 class QCompleter;
26 
27 namespace Ui
28 {
29  class QmitkMultiLabelManagerControls;
30 }
31 
32 namespace mitk
33 {
34  class DataStorage;
35 }
36 
38 {
39  Q_OBJECT
40 
41 public:
42  explicit QmitkMultiLabelManager(QWidget *parent = nullptr);
43  ~QmitkMultiLabelManager() override;
44 
45 
47 
51  LabelValueVectorType GetSelectedLabels() const;
52 
53 Q_SIGNALS:
59  void CurrentSelectionChanged(LabelValueVectorType labels);
60 
68  void GoToLabel(mitk::LabelSetImage::LabelValueType label, const mitk::Point3D& point) const;
69 
77  void LabelRenameRequested(mitk::Label* label, bool rename) const;
78 
79 public Q_SLOTS:
80 
86  void SetSelectedLabels(const LabelValueVectorType& selectedLabels);
87  void SetSelectedLabel(mitk::LabelSetImage::LabelValueType selectedLabel);
93 
99  void SetMultiLabelSegmentation(mitk::LabelSetImage* segmentation);
100 
101  void SetDataStorage(mitk::DataStorage *storage);
102 
103  void UpdateControls();
104 
105  virtual void setEnabled(bool enabled);
106 
107  QStringList &GetLabelStringList();
108 
109  void SetDefaultLabelNaming(bool defaultLabelNaming);
110 
111 private Q_SLOTS:
112 
113  // LabelSet dependent
114 
115  void OnRenameLabelShortcutActivated();
116 
117  // reaction to "returnPressed" signal from ...
118  void OnSearchLabel();
119  // reaction to the change of labels. If multiple labels are selected, it is ignored.
120  void OnSelectedLabelChanged(LabelValueVectorType labels);
121 
122  // LabelSetImage Dependet
123  void OnCreateDetailedSurface(bool);
124  void OnCreateSmoothedSurface(bool);
125  // reaction to the signal "createMask" from QmitkLabelSetTableWidget
126  void OnCreateMask(bool);
127  // reaction to the signal "createCroppedMask" from QmitkLabelSetTableWidget
128  void OnCreateCroppedMask(bool);
129 
130  void OnSavePreset();
131  void OnLoadPreset();
132 
133  void OnGoToLabel(mitk::LabelSetImage::LabelValueType label, const mitk::Point3D& position) const;
134  void OnLabelRenameRequested(mitk::Label* label, bool rename) const;
135  void OnModelUpdated();
136 
137 private:
138  enum TableColumns
139  {
140  NAME_COL = 0,
141  LOCKED_COL,
142  COLOR_COL,
143  VISIBLE_COL
144  };
145 
146  void WaitCursorOn();
147 
148  void WaitCursorOff();
149 
150  void RestoreOverrideCursor();
151 
152  void OnThreadedCalculationDone();
153 
154  void AddSegmentationObserver();
155  void RemoveSegmentationObserver();
156 
157  void OnLabelEvent(mitk::LabelSetImage::LabelValueType labelValue);
158  void OnGroupEvent(mitk::LabelSetImage::GroupIndexType groupIndex);
159 
160  Ui::QmitkMultiLabelManagerControls* m_Controls;
161 
162  QCompleter *m_Completer;
163 
164  QStringList m_OrganColors;
165 
166  QStringList m_LabelStringList;
167 
168  bool m_ProcessingManualSelection;
169 
170  mitk::LabelSetImage::Pointer m_Segmentation;
171  mitk::DataNode::Pointer m_SegmentationNode;
172  mitk::DataStorage* m_DataStorage;
173 
174 };
175 
176 #endif
MITKSEGMENTATIONUI_EXPORT
#define MITKSEGMENTATIONUI_EXPORT
Definition: MitkSegmentationUIExports.h:15
itk::SmartPointer< Self >
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
Ui
Definition: BlueBerryExampleLauncherDialog.h:21
mitk::Label
A data structure describing a label.
Definition: mitkLabel.h:28
QmitkMultiLabelManager::LabelValueVectorType
mitk::LabelSetImage::LabelValueVectorType LabelValueVectorType
Definition: QmitkMultiLabelManager.h:46
mitk::Point< ScalarType, 3 >
QmitkMultiLabelManager
Definition: QmitkMultiLabelManager.h:37
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
mitk::LabelSetImage::GroupIndexType
std::size_t GroupIndexType
Definition: mitkLabelSetImage.h:61
mitk::LabelSetImage::LabelValueVectorType
std::vector< LabelValueType > LabelValueVectorType
Definition: mitkLabelSetImage.h:66
mitk::LabelSetImage
LabelSetImage class for handling labels and layers in a segmentation session.
Definition: mitkLabelSetImage.h:29
mitk::LabelSetImage::LabelValueType
mitk::Label::PixelType LabelValueType
Definition: mitkLabelSetImage.h:62
mitkLabelSetImage.h