Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::LabelHighlightGuard Class Reference

RAII guard for managing label highlighting on data nodes. More...

#include <mitkLabelHighlightGuard.h>

Collaboration diagram for mitk::LabelHighlightGuard:

Public Member Functions

void SetSegmentationNode (DataNode *node)
 Sets the segmentation node on which labels should be highlighted. More...
 
DataNode::Pointer GetSegmentationNode () const
 Returns the currently associated segmentation data node. More...
 
void SetHighlightedLabels (MultiLabelSegmentation::LabelValueVectorType labels)
 Sets the label values that should be highlighted. More...
 
MultiLabelSegmentation::LabelValueVectorType GetHighlightedLabels () const
 Returns the currently highlighted label values. More...
 
void SetHighlightInvisibleLabels (bool highlightInvisible)
 Sets whether invisible labels should also be highlighted. More...
 
 ~LabelHighlightGuard ()
 Destructor. Removes all highlighting from the associated node. More...
 

Static Public Member Functions

constexpr static const char * PROPERTY_NAME_LABELS_HIGHLIGHTED ()
 Returns the property name used to store highlighted label values on a data node. More...
 
constexpr static const char * PROPERTY_NAME_HIGHLIGHT_INVISIBLE ()
 Returns the property name used to control highlighting of invisible labels. More...
 

Static Protected Member Functions

static void UpdateNode (DataNode *node, MultiLabelSegmentation::LabelValueVectorType labels, bool highlightInvisible)
 

Protected Attributes

MultiLabelSegmentation::LabelValueVectorType m_Labels
 
bool m_HighlightInvisible
 
WeakPointer< DataNode > m_Node
 

Detailed Description

RAII guard for managing label highlighting on data nodes.

This helper class manages the node properties used for label highlighting in multi-label segmentations. It ensures that highlighting is always properly removed when:

  • The destructor of the guard is called, or
  • The segmentation node changes (highlighting on the former node is removed).

The guard also triggers the RenderingManager to refresh render windows when highlighting state changes.

See also
MultiLabelSegmentation, LabelSetImageVtkMapper2D

Definition at line 50 of file mitkLabelHighlightGuard.h.

Constructor & Destructor Documentation

◆ ~LabelHighlightGuard()

mitk::LabelHighlightGuard::~LabelHighlightGuard ( )

Destructor. Removes all highlighting from the associated node.

Member Function Documentation

◆ GetHighlightedLabels()

MultiLabelSegmentation::LabelValueVectorType mitk::LabelHighlightGuard::GetHighlightedLabels ( ) const

Returns the currently highlighted label values.

Returns
Vector of highlighted label values.

◆ GetSegmentationNode()

DataNode::Pointer mitk::LabelHighlightGuard::GetSegmentationNode ( ) const

Returns the currently associated segmentation data node.

Returns
Smart pointer to the segmentation node, or nullptr if none is set.

◆ PROPERTY_NAME_HIGHLIGHT_INVISIBLE()

constexpr static const char* mitk::LabelHighlightGuard::PROPERTY_NAME_HIGHLIGHT_INVISIBLE ( )
inlinestaticconstexpr

Returns the property name used to control highlighting of invisible labels.

Returns
The property name string "org.mitk.multilabel.highlight_invisible".

Definition at line 108 of file mitkLabelHighlightGuard.h.

◆ PROPERTY_NAME_LABELS_HIGHLIGHTED()

constexpr static const char* mitk::LabelHighlightGuard::PROPERTY_NAME_LABELS_HIGHLIGHTED ( )
inlinestaticconstexpr

Returns the property name used to store highlighted label values on a data node.

Returns
The property name string "org.mitk.multilabel.labels.highlighted".

Definition at line 99 of file mitkLabelHighlightGuard.h.

◆ SetHighlightedLabels()

void mitk::LabelHighlightGuard::SetHighlightedLabels ( MultiLabelSegmentation::LabelValueVectorType  labels)

Sets the label values that should be highlighted.

Only takes effect if a segmentation node is set. Triggers a render update.

Parameters
[in]labelsVector of label values to highlight.

◆ SetHighlightInvisibleLabels()

void mitk::LabelHighlightGuard::SetHighlightInvisibleLabels ( bool  highlightInvisible)

Sets whether invisible labels should also be highlighted.

Parameters
[in]highlightInvisibleIf true, labels that are invisible will also be highlighted.

◆ SetSegmentationNode()

void mitk::LabelHighlightGuard::SetSegmentationNode ( DataNode *  node)

Sets the segmentation node on which labels should be highlighted.

If a different node was previously set, the highlighting on the old node is removed first. Setting nullptr removes all highlighting.

Parameters
[in]nodePointer to the data node, or nullptr to clear highlighting.

◆ UpdateNode()

static void mitk::LabelHighlightGuard::UpdateNode ( DataNode *  node,
MultiLabelSegmentation::LabelValueVectorType  labels,
bool  highlightInvisible 
)
staticprotected

Member Data Documentation

◆ m_HighlightInvisible

bool mitk::LabelHighlightGuard::m_HighlightInvisible
protected

Definition at line 116 of file mitkLabelHighlightGuard.h.

◆ m_Labels

MultiLabelSegmentation::LabelValueVectorType mitk::LabelHighlightGuard::m_Labels
protected

Definition at line 115 of file mitkLabelHighlightGuard.h.

◆ m_Node

WeakPointer<DataNode> mitk::LabelHighlightGuard::m_Node
protected

Definition at line 117 of file mitkLabelHighlightGuard.h.


The documentation for this class was generated from the following file: