Medical Imaging Interaction Toolkit  2025.12.02
Medical Imaging Interaction Toolkit
QmitkMultiLabelSelectionButton.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 QmitkMultiLabelSelectionButton_h
14 #define QmitkMultiLabelSelectionButton_h
15 
17 
18 #include <mitkWeakPointer.h>
19 #include <mitkLabelSetImage.h>
20 #include <mitkDataNode.h>
22 
23 #include <QPushButton>
24 
32 {
33  Q_OBJECT
34 
35 public:
36  QmitkMultiLabelSelectionButton(QWidget* parent = nullptr);
38 
42  QString GetEmptyInfo() const;
43 
46 
51 
52 Q_SIGNALS:
59 
60 public Q_SLOTS:
61 
68  void SetSelectedLabels(const LabelValueVectorType& selectedLabels);
69 
77 
86 
94 
95  void SetHighlightingActivated(bool visiblityMod);
96 
100  void SetEmptyInfo(QString info);
101 
102 protected:
103  void paintEvent(QPaintEvent* p) override;
104  void changeEvent(QEvent* event) override;
105  void enterEvent(QEnterEvent* event) override;
106  void leaveEvent(QEvent* event) override;
107 
108 private:
109  bool m_HighlightingActivated = true;
110  LabelValueVectorType m_LastValidSelectedLabels;
111  mitk::MultiLabelSegmentation::Pointer m_Segmentation;
112  mitk::DataNode::Pointer m_SegmentationNode;
113  unsigned long m_SegmentationNodeDataMTime;
114  mitk::ITKEventObserverGuard m_SegmentationObserver;
115  mitk::LabelHighlightGuard m_LabelHighlightGuard;
116  QString m_EmptyInfo;
117 };
118 
119 #endif
#define MITKSEGMENTATIONUI_EXPORT
Button class that can be used to display information about selected labels of a given multi label seg...
mitk::MultiLabelSegmentation * GetMultiLabelSegmentation() const
void changeEvent(QEvent *event) override
void SetSelectedLabel(mitk::MultiLabelSegmentation::LabelValueType selectedLabel)
The passed label will be used as new selection in the widget.
void paintEvent(QPaintEvent *p) override
LabelValueVectorType GetSelectedLabels() const
Retrieve the currently selected labels (equals the last CurrentSelectionChanged values).
mitk::DataNode * GetMultiLabelNode() const
void SetMultiLabelSegmentation(mitk::MultiLabelSegmentation *segmentation)
Sets the segmentation that will be used and monitored by the widget.
void enterEvent(QEnterEvent *event) override
void SetMultiLabelNode(mitk::DataNode *node)
Sets the segmentation node that will be used /monitored by the widget.
mitk::MultiLabelSegmentation::LabelValueType LabelValueType
void CurrentSelectionChanged(LabelValueVectorType labels) const
A signal that will be emitted if the selected labels change.
QmitkMultiLabelSelectionButton(QWidget *parent=nullptr)
void SetHighlightingActivated(bool visiblityMod)
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 leaveEvent(QEvent *event) override
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