Medical Imaging Interaction Toolkit  2025.08.99-f7084adb
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 
43  bool GetHighlightingActivated() const;
44  mitk::MultiLabelSegmentation* GetMultiLabelSegmentation() const;
45  mitk::DataNode* GetMultiLabelNode() const;
46  QString GetEmptyInfo() const;
47 
50 
54  LabelValueVectorType GetSelectedLabels() const;
55 
56 Q_SIGNALS:
62  void CurrentSelectionChanged(LabelValueVectorType labels) const;
63 
64 public Q_SLOTS:
65 
72  void SetSelectedLabels(const LabelValueVectorType& selectedLabels);
79  void SetSelectedLabel(mitk::MultiLabelSegmentation::LabelValueType selectedLabel);
80 
88  void SetMultiLabelSegmentation(mitk::MultiLabelSegmentation* segmentation);
89 
96  void SetMultiLabelNode(mitk::DataNode* node);
97 
98  void SetHighlightingActivated(bool visiblityMod);
99 
103  void SetEmptyInfo(QString info);
104 
105 protected:
106  void Initialize();
107  void UpdateWidget();
108 
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
MITKSEGMENTATIONUI_EXPORT
#define MITKSEGMENTATIONUI_EXPORT
Definition: MitkSegmentationUIExports.h:15
mitk::LabelHighlightGuard
Definition: mitkLabelHighlightGuard.h:29
QmitkMultiLabelSelectionLabel::LabelValueVectorType
mitk::MultiLabelSegmentation::LabelValueVectorType LabelValueVectorType
Definition: QmitkMultiLabelSelectionLabel.h:49
mitk::ITKEventObserverGuard
Convenience class that helps to manage the lifetime of itk event observers.
Definition: mitkITKEventObserverGuard.h:55
QmitkMultiLabelSelectionLabel
Definition: QmitkMultiLabelSelectionLabel.h:35
QmitkMultiLabelSelectionLabel::LabelValueType
mitk::MultiLabelSegmentation::LabelValueType LabelValueType
Definition: QmitkMultiLabelSelectionLabel.h:48
itk::SmartPointer< Self >
mitk::MultiLabelSegmentation::LabelValueType
mitk::Label::PixelType LabelValueType
Definition: mitkLabelSetImage.h:57
mitkLabelHighlightGuard.h
QmitkMultiLabelSelectionLabel::m_Controls
std::unique_ptr< Ui::QmitkMultiLabelSelectionLabel > m_Controls
Definition: QmitkMultiLabelSelectionLabel.h:113
mitk::MultiLabelSegmentation::LabelValueVectorType
std::vector< LabelValueType > LabelValueVectorType
Definition: mitkLabelSetImage.h:60
Ui
Definition: BlueBerryExampleLauncherDialog.h:21
mitk::MultiLabelSegmentation
MultiLabelSegmentation class for handling labels and layers in a segmentation session.
Definition: mitkLabelSetImage.h:43
QmitkMultiLabelSelectionLabel::m_LastValidSelectedLabels
LabelValueVectorType m_LastValidSelectedLabels
Definition: QmitkMultiLabelSelectionLabel.h:111
QmitkMultiLabelSelectionLabel::m_Segmentation
mitk::MultiLabelSegmentation::Pointer m_Segmentation
Definition: QmitkMultiLabelSelectionLabel.h:109
mitkDataNode.h
mitkWeakPointer.h
MitkSegmentationUIExports.h
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
mitkLabelSetImage.h