Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkLabelHighlightGuard.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 mitkLabelHighlightGuard_h
14 #define mitkLabelHighlightGuard_h
15 
16 #include <MitkMultilabelExports.h>
17 
18 #include <mitkDataNode.h>
19 #include <mitkLabelSetImage.h>
20 
21 namespace mitk
22 {
28  inline constexpr double HIGHLIGHTED_LABEL_OPACITY = 1.0;
29 
34  inline constexpr double FADED_LABEL_OPACITY = 0.1;
35 
51  {
52  public:
62 
67  DataNode::Pointer GetSegmentationNode() const;
68 
77 
83 
88  void SetHighlightInvisibleLabels(bool highlightInvisible);
89 
94 
99  constexpr static const char* PROPERTY_NAME_LABELS_HIGHLIGHTED()
100  {
101  return "org.mitk.multilabel.labels.highlighted";
102  };
103 
108  constexpr static const char* PROPERTY_NAME_HIGHLIGHT_INVISIBLE()
109  {
110  return "org.mitk.multilabel.highlight_invisible";
111  };
112 
113  protected:
114  static void UpdateNode(DataNode* node, MultiLabelSegmentation::LabelValueVectorType labels, bool highlightInvisible);
116  bool m_HighlightInvisible = false;
118  };
119 }
120 
121 #endif
#define MITKMULTILABEL_EXPORT
Central node class of the MITK data tree, associating a data object with properties and mappers.
Definition: mitkDataNode.h:72
RAII guard for managing label highlighting on data nodes.
constexpr static const char * PROPERTY_NAME_LABELS_HIGHLIGHTED()
Returns the property name used to store highlighted label values on a data node.
void SetHighlightedLabels(MultiLabelSegmentation::LabelValueVectorType labels)
Sets the label values that should be highlighted.
MultiLabelSegmentation::LabelValueVectorType GetHighlightedLabels() const
Returns the currently highlighted label values.
static void UpdateNode(DataNode *node, MultiLabelSegmentation::LabelValueVectorType labels, bool highlightInvisible)
void SetHighlightInvisibleLabels(bool highlightInvisible)
Sets whether invisible labels should also be highlighted.
DataNode::Pointer GetSegmentationNode() const
Returns the currently associated segmentation data node.
~LabelHighlightGuard()
Destructor. Removes all highlighting from the associated node.
constexpr static const char * PROPERTY_NAME_HIGHLIGHT_INVISIBLE()
Returns the property name used to control highlighting of invisible labels.
void SetSegmentationNode(DataNode *node)
Sets the segmentation node on which labels should be highlighted.
WeakPointer< DataNode > m_Node
std::vector< LabelValueType > LabelValueVectorType
A weak pointer that observes an itk::Object without preventing its deletion.
Find image slices visible on a given plane.
constexpr double HIGHLIGHTED_LABEL_OPACITY
Opacity applied to a hovered/highlighted label by the multi-label mappers.
constexpr double FADED_LABEL_OPACITY
Opacity floor applied to the other labels while one is hovered/highlighted.