Medical Imaging Interaction Toolkit  2026.06.00
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 
36 {
37  Q_OBJECT
38 
39 public:
41  QmitkMultiLabelSelectionWidget(QWidget* parent = nullptr);
43 
45  bool GetMultiSelectionMode() const;
46 
54  QString GetEmptyInfo() const;
55 
61  mitk::Image::Pointer CreateSelectedLabelMask() const;
62 
65 
70 
71 Q_SIGNALS:
78 
80  void SegmentationChanged() const;
81 
82 public Q_SLOTS:
83 
90  void SetSelectedLabels(const LabelValueVectorType& selectedLabels);
98 
107 
119 
120  void SetMultiSelectionMode(bool multiMode);
121 
122  void SetHighlightingActivated(bool visiblityMod);
123 
127  void SetEmptyInfo(QString info);
128 
129 protected:
130  void resizeEvent(QResizeEvent* event) override;
131 
132 private slots:
133  void ShowPopup();
134  void HidePopup();
135  void OnSelectionFinished();
136 
137 private:
138  void PositionPopup();
139 
140  std::unique_ptr<Ui::QmitkMultiLabelSelectionWidget> m_Controls;
141  std::unique_ptr<QmitkMultiLabelInspectorPopup> m_Popup;
142 
143 };
144 
149 class QmitkMultiLabelInspectorPopup : public QWidget
150 {
151  Q_OBJECT
152 
153 public:
154  explicit QmitkMultiLabelInspectorPopup(QWidget* parent = nullptr);
156 
159 
160 signals:
165 
166 private slots:
167  void OnPopupLabelsChanged(const LabelValueVectorType& selectedLabels);
168 
169 private:
170  std::unique_ptr<QmitkMultiLabelInspector> m_Inspector;
171 };
172 
173 #endif
#define MITKSEGMENTATIONUI_EXPORT
This class is the pop-up used by QmitkMultiLabelSelectionWidget for selection labels.
QmitkMultiLabelSelectionWidget::LabelValueVectorType LabelValueVectorType
void SelectionFinished()
Signal emitted when selection is finished.
QmitkMultiLabelInspector * GetInspector() const
QmitkMultiLabelInspectorPopup(QWidget *parent=nullptr)
Inspector widget providing a tree view on labels and groups of a MultiLabelSegmentation instance.
Selection widget that allows selecting one or multiple labels of a multi-label segmentation.
QString GetEmptyInfo() const
Returns the info text displayed when no label is selected.
mitk::Image::Pointer CreateSelectedLabelMask() const
void SetSelectedLabels(const LabelValueVectorType &selectedLabels)
Transform a list of label values into the new selection of the inspector.
QmitkMultiLabelSelectionWidget(QWidget *parent=nullptr)
Constructs the multi-label selection widget.
void CurrentSelectionChanged(LabelValueVectorType labels) const
A signal that will be emitted if the selected labels change.
bool GetHighlightingActivated() const
Returns whether label highlighting in render windows is activated.
mitk::MultiLabelSegmentation::LabelValueVectorType LabelValueVectorType
LabelValueVectorType GetSelectedLabels() const
Retrieve the currently selected labels (equals the last CurrentSelectionChanged values).
void SegmentationChanged() const
Signal is emitted, if the segmentation is changed that is observed by the inspector.
void SetHighlightingActivated(bool visiblityMod)
mitk::DataNode * GetMultiLabelNode() const
Returns the segmentation data node.
mitk::MultiLabelSegmentation::LabelValueType LabelValueType
void SetMultiLabelNode(mitk::DataNode *node)
Sets the segmentation node that will be used /monitored by the widget.
void resizeEvent(QResizeEvent *event) override
mitk::MultiLabelSegmentation * GetMultiLabelSegmentation() const
Returns the currently set segmentation.
void SetSelectedLabel(mitk::MultiLabelSegmentation::LabelValueType selectedLabel)
The passed label will be used as new selection in the widget.
void SetMultiLabelSegmentation(mitk::MultiLabelSegmentation *segmentation)
Sets the segmentation that will be used and monitored by the widget.
void SetMultiSelectionMode(bool multiMode)
bool GetMultiSelectionMode() const
Returns whether multi-selection mode is enabled.
void SetEmptyInfo(QString info)
Central node class of the MITK data tree, associating a data object with properties and mappers.
Definition: mitkDataNode.h:72
MultiLabelSegmentation class for handling labels and layers in a segmentation session.
std::vector< LabelValueType > LabelValueVectorType
mitk::Label::PixelType LabelValueType