Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::ROIMapperHelper Namespace Reference

Helper functions shared by ROIMapper2D and ROIMapper3D. More...

Functions

void ApplyIndividualProperties (const ROI::Element &roi, TimeStepType t, vtkActor *actor)
 Apply individual ROI properties at a certain time step to the given actor. More...
 
vtkSmartPointer< vtkCaptionActor2D > CreateCaptionActor (const std::string &caption, const Point3D &attachmentPoint, vtkProperty *property, const DataNode *dataNode, const BaseRenderer *renderer)
 Create a VTK caption actor for an ROI label. More...
 
std::string ParseCaption (const std::string &captionTemplate, const ROI::Element &roi, TimeStepType t=0)
 Substitute all placeholders in a caption template with corresponding property values. More...
 
void SetDefaultProperties (DataNode *node, BaseRenderer *renderer, bool override)
 Set common default properties for both 2D and 3D ROI mappers. More...
 
template<class T >
const T * GetConstProperty (const std::string &propertyKey, const ROI::Element &roi, TimeStepType t)
 Retrieve a typed const property from an ROI element. More...
 

Detailed Description

Helper functions shared by ROIMapper2D and ROIMapper3D.

Provides utilities for applying ROI-specific visual properties to VTK actors, creating caption actors for ROI labels, parsing caption template strings, setting default properties, and retrieving typed ROI properties.

See also
ROIMapper2D, ROIMapper3D, ROI

Function Documentation

◆ ApplyIndividualProperties()

void mitk::ROIMapperHelper::ApplyIndividualProperties ( const ROI::Element &  roi,
TimeStepType  t,
vtkActor *  actor 
)

Apply individual ROI properties at a certain time step to the given actor.

Sets wireframe representation, disables lighting, and applies color, opacity, and line width from the ROI element's properties at the specified time step.

Parameters
roiThe ROI element whose properties are applied.
tThe time step from which to read properties.
actorThe VTK actor to configure.

◆ CreateCaptionActor()

vtkSmartPointer<vtkCaptionActor2D> mitk::ROIMapperHelper::CreateCaptionActor ( const std::string &  caption,
const Point3D &  attachmentPoint,
vtkProperty *  property,
const DataNode *  dataNode,
const BaseRenderer *  renderer 
)

Create a VTK caption actor for an ROI label.

The caption is positioned at the given attachment point and styled according to the color and opacity of the provided VTK property, as well as font properties (size, bold, italic) read from the data node.

Parameters
captionThe text string to display.
attachmentPointThe 3D point where the caption is anchored.
propertyThe VTK property from which to read color and opacity.
dataNodeThe data node from which to read font properties.
rendererThe renderer for renderer-specific property lookup.
Returns
A new vtkCaptionActor2D configured with the specified text and style.

◆ GetConstProperty()

template<class T >
const T* mitk::ROIMapperHelper::GetConstProperty ( const std::string &  propertyKey,
const ROI::Element &  roi,
TimeStepType  t 
)

Retrieve a typed const property from an ROI element.

Convenience template that retrieves a property by key from the ROI element at the given time step and performs a dynamic_cast to the requested type.

Template Parameters
TThe property type to cast to (e.g., ColorProperty, FloatProperty).
Parameters
propertyKeyThe key of the property to look up.
roiThe ROI element to query.
tThe time step for property lookup.
Returns
Pointer to the property cast to type T, or nullptr if not found or cast fails.

Definition at line 106 of file mitkROIMapperHelper.h.

References mitk::ROI::Element::GetConstProperty().

◆ ParseCaption()

std::string mitk::ROIMapperHelper::ParseCaption ( const std::string &  captionTemplate,
const ROI::Element &  roi,
TimeStepType  t = 0 
)

Substitute all placeholders in a caption template with corresponding property values.

Placeholders are delimited by curly braces (e.g., {ID}, {name}). The special placeholder {ID} is replaced by the ROI element's numeric ID. All other placeholders are looked up as properties of the ROI element at the given time step. If no placeholders are found, the template string is returned as-is.

Parameters
captionTemplateThe template string containing placeholders.
roiThe ROI element from which to read property values.
tThe time step for property lookup (default is 0).
Returns
The caption string with all placeholders substituted.
See also
ROI

◆ SetDefaultProperties()

void mitk::ROIMapperHelper::SetDefaultProperties ( DataNode *  node,
BaseRenderer *  renderer,
bool  override 
)

Set common default properties for both 2D and 3D ROI mappers.

Configures default values for opacity, font style (bold, italic, size), and caption template ("{ID}\\n{name}").

Parameters
nodeThe data node to decorate with default properties.
rendererThe renderer for renderer-specific properties, or nullptr for global defaults.
overrideWhether to overwrite existing properties.