Medical Imaging Interaction Toolkit  2025.08.99-f7084adb
Medical Imaging Interaction Toolkit
QmitkMultiLabelSelectionWidget.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 QmitkMultiLabelSelectionWidget_h
14 #define QmitkMultiLabelSelectionWidget_h
15 
17 #include <mitkWeakPointer.h>
18 #include <mitkLabelSetImage.h>
19 #include <mitkDataNode.h>
21 
22 #include <QWidget>
23 
26 
27 namespace Ui
28 {
30 }
31 
32 /*
33 * @brief This is a selection widget that allows to select one or multiple labels of a multi label segmentation.
34 */
36 {
37  Q_OBJECT
38 
39 public:
40  QmitkMultiLabelSelectionWidget(QWidget* parent = nullptr);
42 
43  bool GetMultiSelectionMode() const;
44 
45  bool GetHighlightingActivated() const;
46  mitk::MultiLabelSegmentation* GetMultiLabelSegmentation() const;
47  mitk::DataNode* GetMultiLabelNode() const;
48  QString GetEmptyInfo() const;
49 
55  mitk::Image::Pointer CreateSelectedLabelMask() const;
56 
59 
63  LabelValueVectorType GetSelectedLabels() const;
64 
65 Q_SIGNALS:
71  void CurrentSelectionChanged(LabelValueVectorType labels) const;
72 
74  void SegmentationChanged() const;
75 
76 public Q_SLOTS:
77 
84  void SetSelectedLabels(const LabelValueVectorType& selectedLabels);
91  void SetSelectedLabel(mitk::MultiLabelSegmentation::LabelValueType selectedLabel);
92 
100  void SetMultiLabelSegmentation(mitk::MultiLabelSegmentation* segmentation);
101 
112  void SetMultiLabelNode(mitk::DataNode* node);
113 
114  void SetMultiSelectionMode(bool multiMode);
115 
116  void SetHighlightingActivated(bool visiblityMod);
117 
121  void SetEmptyInfo(QString info);
122 
123 protected:
124  void resizeEvent(QResizeEvent* event) override;
125 
126 private slots:
127  void ShowPopup();
128  void HidePopup();
129  void OnSelectionFinished();
130 
131 private:
132  void PositionPopup();
133 
134  std::unique_ptr<Ui::QmitkMultiLabelSelectionWidget> m_Controls;
135  std::unique_ptr<QmitkMultiLabelInspectorPopup> m_Popup;
136 
137 };
138 
143 class QmitkMultiLabelInspectorPopup : public QWidget
144 {
145  Q_OBJECT
146 
147 public:
148  explicit QmitkMultiLabelInspectorPopup(QWidget* parent = nullptr);
150 
153 
154 signals:
158  void SelectionFinished();
159 
160 private slots:
161  void OnPopupLabelsChanged(const LabelValueVectorType& selectedLabels);
162 
163 private:
164  std::unique_ptr<QmitkMultiLabelInspector> m_Inspector;
165 };
166 
167 #endif
MITKSEGMENTATIONUI_EXPORT
#define MITKSEGMENTATIONUI_EXPORT
Definition: MitkSegmentationUIExports.h:15
QmitkMultiLabelSelectionWidget::LabelValueVectorType
mitk::MultiLabelSegmentation::LabelValueVectorType LabelValueVectorType
Definition: QmitkMultiLabelSelectionWidget.h:58
QmitkMultiLabelInspectorPopup::QmitkMultiLabelInspectorPopup
QmitkMultiLabelInspectorPopup(QWidget *parent=nullptr)
QmitkMultiLabelInspectorPopup::SelectionFinished
void SelectionFinished()
Signal emitted when selection is finished.
itk::SmartPointer< Self >
mitk::MultiLabelSegmentation::LabelValueType
mitk::Label::PixelType LabelValueType
Definition: mitkLabelSetImage.h:57
mitkLabelHighlightGuard.h
mitk::MultiLabelSegmentation::LabelValueVectorType
std::vector< LabelValueType > LabelValueVectorType
Definition: mitkLabelSetImage.h:60
Ui
Definition: BlueBerryExampleLauncherDialog.h:21
QmitkMultiLabelInspectorPopup
This class is the pop-up used by QmitkMultiLabelSelectionWidget for selection labels.
Definition: QmitkMultiLabelSelectionWidget.h:143
mitk::MultiLabelSegmentation
MultiLabelSegmentation class for handling labels and layers in a segmentation session.
Definition: mitkLabelSetImage.h:43
QmitkMultiLabelInspectorPopup::~QmitkMultiLabelInspectorPopup
~QmitkMultiLabelInspectorPopup()
QmitkMultiLabelInspectorPopup::LabelValueVectorType
QmitkMultiLabelSelectionWidget::LabelValueVectorType LabelValueVectorType
Definition: QmitkMultiLabelSelectionWidget.h:152
QmitkMultiLabelSelectionWidget::LabelValueType
mitk::MultiLabelSegmentation::LabelValueType LabelValueType
Definition: QmitkMultiLabelSelectionWidget.h:57
mitkDataNode.h
mitkWeakPointer.h
QmitkMultiLabelInspector
Definition: QmitkMultiLabelInspector.h:38
MitkSegmentationUIExports.h
QmitkMultiLabelInspectorPopup::GetInspector
QmitkMultiLabelInspector * GetInspector() const
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
QmitkMultiLabelSelectionWidget
Definition: QmitkMultiLabelSelectionWidget.h:35
mitkLabelSetImage.h