Medical Imaging Interaction Toolkit  2025.08.99-f7084adb
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 
39  bool GetHighlightingActivated() const;
40  mitk::MultiLabelSegmentation* GetMultiLabelSegmentation() const;
41  mitk::DataNode* GetMultiLabelNode() const;
42  QString GetEmptyInfo() const;
43 
46 
50  LabelValueVectorType GetSelectedLabels() const;
51 
52 Q_SIGNALS:
58  void CurrentSelectionChanged(LabelValueVectorType labels) const;
59 
60 public Q_SLOTS:
61 
68  void SetSelectedLabels(const LabelValueVectorType& selectedLabels);
69 
76  void SetSelectedLabel(mitk::MultiLabelSegmentation::LabelValueType selectedLabel);
77 
85  void SetMultiLabelSegmentation(mitk::MultiLabelSegmentation* segmentation);
86 
93  void SetMultiLabelNode(mitk::DataNode* node);
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;
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
QmitkMultiLabelSelectionButton::LabelValueType
mitk::MultiLabelSegmentation::LabelValueType LabelValueType
Definition: QmitkMultiLabelSelectionButton.h:44
MITKSEGMENTATIONUI_EXPORT
#define MITKSEGMENTATIONUI_EXPORT
Definition: MitkSegmentationUIExports.h:15
mitk::LabelHighlightGuard
Definition: mitkLabelHighlightGuard.h:29
mitk::ITKEventObserverGuard
Convenience class that helps to manage the lifetime of itk event observers.
Definition: mitkITKEventObserverGuard.h:55
itk::SmartPointer< Self >
QmitkMultiLabelSelectionButton
Button class that can be used to display information about selected labels of a given multi label seg...
Definition: QmitkMultiLabelSelectionButton.h:31
mitk::MultiLabelSegmentation::LabelValueType
mitk::Label::PixelType LabelValueType
Definition: mitkLabelSetImage.h:57
mitkLabelHighlightGuard.h
mitk::MultiLabelSegmentation::LabelValueVectorType
std::vector< LabelValueType > LabelValueVectorType
Definition: mitkLabelSetImage.h:60
mitk::MultiLabelSegmentation
MultiLabelSegmentation class for handling labels and layers in a segmentation session.
Definition: mitkLabelSetImage.h:43
QmitkMultiLabelSelectionButton::LabelValueVectorType
mitk::MultiLabelSegmentation::LabelValueVectorType LabelValueVectorType
Definition: QmitkMultiLabelSelectionButton.h:45
mitkDataNode.h
mitkWeakPointer.h
MitkSegmentationUIExports.h
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
mitkLabelSetImage.h