Medical Imaging Interaction Toolkit  2025.12.02
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 
29 /*
30 * @brief This is a widget that behaves like a QLabel widget and displays the selected labels of
31 * a segmentation with name and color.
32 * It also allows label highlighting in render windows if the node is set and
33 * mouse hovers over the widget.
34 */
36 {
37  Q_OBJECT
38 
39 public:
40  QmitkMultiLabelSelectionLabel(QWidget* parent = nullptr);
42 
46  QString GetEmptyInfo() const;
47 
50 
55 
56 Q_SIGNALS:
63 
64 public Q_SLOTS:
65 
72  void SetSelectedLabels(const LabelValueVectorType& selectedLabels);
80 
89 
97 
98  void SetHighlightingActivated(bool visiblityMod);
99 
103  void SetEmptyInfo(QString info);
104 
105 protected:
106  void Initialize();
107  void UpdateWidget();
108 
109  mitk::MultiLabelSegmentation::Pointer m_Segmentation;
110 
112 
113  std::unique_ptr<Ui::QmitkMultiLabelSelectionLabel> m_Controls;
114 
115 private Q_SLOTS:
116  void enterEvent(QEnterEvent* event) override;
117  void leaveEvent(QEvent* event) override;
118 
119 private:
120  bool m_HighlightingActivated = true;
121  mitk::DataNode::Pointer m_SegmentationNode;
122  unsigned long m_SegmentationNodeDataMTime;
123  mitk::ITKEventObserverGuard m_SegmentationObserver;
124  mitk::LabelHighlightGuard m_LabelHighlightGuard;
125  QString m_EmptyInfo;
126 };
127 
128 #endif
#define MITKSEGMENTATIONUI_EXPORT
mitk::MultiLabelSegmentation::LabelValueType LabelValueType
LabelValueVectorType GetSelectedLabels() const
Retrieve the currently selected labels (equals the last CurrentSelectionChanged values).
QmitkMultiLabelSelectionLabel(QWidget *parent=nullptr)
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
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
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
Class for nodes of the DataTree.
Definition: mitkDataNode.h:64
Convenience class that helps to manage the lifetime of itk event observers.
MultiLabelSegmentation class for handling labels and layers in a segmentation session.
std::vector< LabelValueType > LabelValueVectorType
mitk::Label::PixelType LabelValueType