Medical Imaging Interaction Toolkit  2025.12.02
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 
48  QString GetEmptyInfo() const;
49 
56 
59 
64 
65 Q_SIGNALS:
72 
74  void SegmentationChanged() const;
75 
76 public Q_SLOTS:
77 
84  void SetSelectedLabels(const LabelValueVectorType& selectedLabels);
92 
101 
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:
159 
160 private slots:
161  void OnPopupLabelsChanged(const LabelValueVectorType& selectedLabels);
162 
163 private:
164  std::unique_ptr<QmitkMultiLabelInspector> m_Inspector;
165 };
166 
167 #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)
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)
void CurrentSelectionChanged(LabelValueVectorType labels) const
A signal that will be emitted if the selected labels change.
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
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
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)
void SetEmptyInfo(QString info)
Class for nodes of the DataTree.
Definition: mitkDataNode.h:64
MultiLabelSegmentation class for handling labels and layers in a segmentation session.
std::vector< LabelValueType > LabelValueVectorType
mitk::Label::PixelType LabelValueType