Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkMultiLabelSelectionLabel.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 QmitkMultiLabelSelectionLabel_h
14 #define QmitkMultiLabelSelectionLabel_h
15 
17 #include <mitkWeakPointer.h>
18 #include <mitkLabelSetImage.h>
19 #include <mitkDataNode.h>
21 
22 #include <QWidget>
23 
24 namespace Ui
25 {
27 }
28 
36 {
37  Q_OBJECT
38 
39 public:
41  QmitkMultiLabelSelectionLabel(QWidget* parent = nullptr);
43 
51  QString GetEmptyInfo() const;
52 
55 
60 
61 Q_SIGNALS:
68 
69 public Q_SLOTS:
70 
77  void SetSelectedLabels(const LabelValueVectorType& selectedLabels);
85 
94 
102 
103  void SetHighlightingActivated(bool visiblityMod);
104 
108  void SetEmptyInfo(QString info);
109 
110 protected:
111  void Initialize();
112  void UpdateWidget();
113 
114  mitk::MultiLabelSegmentation::Pointer m_Segmentation;
115 
117 
118  std::unique_ptr<Ui::QmitkMultiLabelSelectionLabel> m_Controls;
119 
120 private Q_SLOTS:
121  void enterEvent(QEnterEvent* event) override;
122  void leaveEvent(QEvent* event) override;
123 
124 private:
125  bool m_HighlightingActivated = true;
126  mitk::DataNode::Pointer m_SegmentationNode;
127  unsigned long m_SegmentationNodeDataMTime;
128  mitk::ITKEventObserverGuard m_SegmentationObserver;
129  mitk::LabelHighlightGuard m_LabelHighlightGuard;
130  QString m_EmptyInfo;
131 };
132 
133 #endif
#define MITKSEGMENTATIONUI_EXPORT
Widget that behaves like a QLabel and displays selected labels of a segmentation with name and color.
mitk::MultiLabelSegmentation::LabelValueType LabelValueType
QString GetEmptyInfo() const
Returns the info text displayed when no label is selected.
LabelValueVectorType GetSelectedLabels() const
Retrieve the currently selected labels (equals the last CurrentSelectionChanged values).
QmitkMultiLabelSelectionLabel(QWidget *parent=nullptr)
Constructs the multi-label selection label widget.
void SetEmptyInfo(QString info)
mitk::MultiLabelSegmentation::LabelValueVectorType LabelValueVectorType
void SetSelectedLabels(const LabelValueVectorType &selectedLabels)
Transform a list of label values into the new selection of the inspector.
void SetMultiLabelSegmentation(mitk::MultiLabelSegmentation *segmentation)
Sets the segmentation that will be used and monitored by the widget.
bool GetHighlightingActivated() const
Returns whether label highlighting in render windows is activated.
mitk::MultiLabelSegmentation::Pointer m_Segmentation
void SetHighlightingActivated(bool visiblityMod)
void CurrentSelectionChanged(LabelValueVectorType labels) const
A signal that will be emitted if the selected labels change.
mitk::MultiLabelSegmentation * GetMultiLabelSegmentation() const
Returns the currently set segmentation.
void SetMultiLabelNode(mitk::DataNode *node)
Sets the segmentation node that will be used /monitored by the widget.
void SetSelectedLabel(mitk::MultiLabelSegmentation::LabelValueType selectedLabel)
The passed label will be used as new selection in the widget.
std::unique_ptr< Ui::QmitkMultiLabelSelectionLabel > m_Controls
mitk::DataNode * GetMultiLabelNode() const
Returns the segmentation data node.
Central node class of the MITK data tree, associating a data object with properties and mappers.
Definition: mitkDataNode.h:72
Convenience class that helps to manage the lifetime of itk event observers.
RAII guard for managing label highlighting on data nodes.
MultiLabelSegmentation class for handling labels and layers in a segmentation session.
std::vector< LabelValueType > LabelValueVectorType
mitk::Label::PixelType LabelValueType