Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
QmitkLabelSetWidget.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 QmitkLabelSetWidget_h
14 #define QmitkLabelSetWidget_h
15 
17 
19 #include <mitkLabel.h>
20 #include <mitkNumericTypes.h>
21 #include <ui_QmitkLabelSetWidgetControls.h>
22 
24 class QCompleter;
25 
26 namespace mitk
27 {
28  class LabelSetImage;
29  class LabelSet;
30  class Label;
31  class DataStorage;
32  class ToolManager;
33  class DataNode;
34 }
35 
37 {
38  Q_OBJECT
39 
40 public:
41  explicit QmitkLabelSetWidget(QWidget *parent = nullptr);
42  ~QmitkLabelSetWidget() override;
43 
44  void SetDataStorage(mitk::DataStorage *storage);
45 
46  void UpdateControls();
47 
48  virtual void setEnabled(bool enabled);
49 
50  QStringList &GetLabelStringList();
51 
52 signals:
53 
55  void goToLabel(const mitk::Point3D &);
56  void LabelSetWidgetReset();
57 
58 public slots:
59 
67  void UpdateAllTableWidgetItems();
68  void UpdateAllTableWidgetItems(mitk::Label::PixelType);
76  void ResetAllTableWidgetItems();
77  void ResetAllTableWidgetItems(mitk::Label::PixelType);
78 
79  void SelectLabelByPixelValue(mitk::Label::PixelType pixelValue);
80 
81 private slots:
82 
83  // LabelSet dependent
84  void OnOpacityChanged(int);
85  void OnUnlockAllLabels(bool);
86  void OnLockAllLabels(bool);
87  void OnSetAllLabelsVisible(bool);
88  void OnSetAllLabelsInvisible(bool);
89  void OnSetOnlyActiveLabelVisible(bool);
90  void OnRandomColor(bool);
91  void OnRemoveLabel(bool);
92  void OnRemoveLabels(bool);
93  void OnRenameLabel(bool);
94  void OnRenameLabelShortcutActivated();
95  void OnLockedButtonClicked();
96  void OnVisibleButtonClicked();
97  void OnColorButtonClicked();
98  void OnItemClicked(QTableWidgetItem *item);
99  void OnItemDoubleClicked(QTableWidgetItem *item);
100  void OnTableViewContextMenuRequested(const QPoint &);
101  void InsertTableWidgetItem(mitk::Label *label);
102  void UpdateTableWidgetItem(QTableWidgetItem *item);
103  // reaction to "returnPressed" signal from ...
104  void OnSearchLabel();
105  // reaction to the button "Change Label"
106  void OnActiveLabelChanged(int pixelValue);
107 
108  // LabelSetImage Dependent
109  void OnCreateDetailedSurface(bool);
110  void OnCreateSmoothedSurface(bool);
111  // reaction to the signal "createMask" from QmitkLabelSetTableWidget
112  void OnCreateMask(bool);
113  void OnCreateMasks(bool);
114  // reaction to the signal "createCroppedMask" from QmitkLabelSetTableWidget
115  void OnCreateCroppedMask(bool);
116  void OnCombineAndCreateMask(bool);
117  void OnCombineAndCreateSurface(bool);
118  void OnEraseLabel(bool);
119  void OnEraseLabels(bool);
120  void OnMergeLabels(bool);
121 
122  // reaction to signal "labelListModified" from QmitkLabelSetTableWidget
123  void OnLabelListModified(const QStringList &list);
124  // reaction to the signal "toggleOutline" from QmitkLabelSetTableWidget
125  void OnToggleOutline(bool);
126  void OnRowsInserted(const QModelIndex&, int, int);
127  void OnRowsRemoved(const QModelIndex&, int, int);
128 
129 private:
130  enum TableColumns
131  {
132  NAME_COL = 0,
133  LOCKED_COL,
134  COLOR_COL,
135  VISIBLE_COL
136  };
137 
138  void WaitCursorOn();
139 
140  void WaitCursorOff();
141 
142  void RestoreOverrideCursor();
143 
144  void OnThreadedCalculationDone();
145 
146  void InitializeTableWidget();
147 
148  int GetPixelValueOfSelectedItem();
149 
150  mitk::LabelSetImage *GetWorkingImage();
151 
152  mitk::DataNode *GetWorkingNode();
153 
154  Ui::QmitkLabelSetWidgetControls m_Controls;
155 
156  mitk::ColorSequenceRainbow m_ColorSequenceRainbow;
157 
158  mitk::DataStorage *m_DataStorage;
159 
160  QCompleter *m_Completer;
161 
162  mitk::ToolManager *m_ToolManager;
163 
164  QStringList m_OrganColors;
165 
166  QStringList m_LabelStringList;
167 
168  bool m_ProcessingManualSelection;
169 };
170 
171 #endif
mitkLabel.h
mitkColorSequenceRainbow.h
mitk::ColorSequenceRainbow
Definition: mitkColorSequenceRainbow.h:20
mitk::Label::PixelType
unsigned short PixelType
Definition: mitkLabel.h:34
MITK_QT_SEGMENTATION
#define MITK_QT_SEGMENTATION
Definition: org_mitk_gui_qt_segmentation_Export.h:26
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::ToolManager
Manages and coordinates instances of mitk::Tool.
Definition: mitkToolManager.h:80
mitk::Label
A data structure describing a label.
Definition: mitkLabel.h:29
org_mitk_gui_qt_segmentation_Export.h
mitk::Point< ScalarType, 3 >
mitkNumericTypes.h
mitk::DataStorage
Data management class that handles 'was created by' relations.
Definition: mitkDataStorage.h:43
QmitkLabelSetWidget
Definition: QmitkLabelSetWidget.h:36
QmitkDataStorageComboBox
Displays all or a subset (defined by a predicate) of nodes of the Data Storage.
Definition: QmitkDataStorageComboBox.h:38
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
mitk::LabelSetImage
LabelSetImage class for handling labels and layers in a segmentation session.
Definition: mitkLabelSetImage.h:29