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

VTK-based 2D mapper for rendering a crosshair. More...

#include <mitkCrosshairVtkMapper2D.h>

Inheritance diagram for mitk::CrosshairVtkMapper2D:
Collaboration diagram for mitk::CrosshairVtkMapper2D:

Classes

class  LocalStorage
 Internal class holding the mapper, actor, etc. for each of the 2D render windows. More...
 

Public Member Functions

 mitkClassMacro (CrosshairVtkMapper2D, VtkMapper)
 
const CrosshairData * GetInput () const
 Get the input CrosshairData from the data node. More...
 
void Update (mitk::BaseRenderer *renderer) override
 Check whether this mapper needs to update itself and generate data. More...
 
vtkProp * GetVtkProp (BaseRenderer *renderer) override
 Get the VTK prop assembly for the given renderer. More...
 
- Public Member Functions inherited from mitk::VtkMapper
 mitkClassMacro (VtkMapper, Mapper)
 
void MitkRender (mitk::BaseRenderer *renderer, mitk::VtkPropRenderer::RenderType type) override
 Determine the render pass type and call the appropriate render method. More...
 
virtual void MitkRenderOverlay (BaseRenderer *renderer)
 Check visibility and render the overlay pass. More...
 
virtual void MitkRenderOpaqueGeometry (BaseRenderer *renderer)
 Check visibility and render opaque (untransparent) geometry. More...
 
virtual void MitkRenderTranslucentGeometry (BaseRenderer *renderer)
 Check visibility and render translucent (transparent) geometry. More...
 
virtual void MitkRenderVolumetricGeometry (BaseRenderer *renderer)
 Check visibility and render volumetric geometry. More...
 
virtual bool HasVtkProp (const vtkProp *prop, BaseRenderer *renderer)
 Check whether this mapper owns the specified vtkProp for the given renderer. More...
 
virtual void UpdateVtkTransform (mitk::BaseRenderer *renderer)
 Set the vtkTransform of the m_Prop3D for the current time step of renderer. More...
 
void ApplyColorAndOpacityProperties (mitk::BaseRenderer *renderer, vtkActor *actor) override
 Apply color and opacity properties read from the PropertyList to the given vtkActor. More...
 
virtual void ReleaseGraphicsResources (mitk::BaseRenderer *)
 Release VTK-based graphics resources consumed by this mapper. More...
 
- Public Member Functions inherited from mitk::Mapper
 mitkClassMacroItkParent (Mapper, itk::Object)
 
virtual void SetDataNode (DataNode *_arg)
 Set the DataNode containing the data to map. More...
 
virtual DataNode * GetDataNode () const
 Get the DataNode containing the data to map. More...
 
TimeStepType GetTimestep () const
 Return the current time step as calculated from the renderer. More...
 
virtual bool IsLODEnabled (BaseRenderer *) const
 Return whether this Mapper currently allows for Level-of-Detail rendering. More...
 

Static Public Member Functions

static Pointer New ()
 
static void SetDefaultProperties (DataNode *node, BaseRenderer *renderer=nullptr, bool overwrite=false)
 Set default properties for the crosshair data node. More...
 
- Static Public Member Functions inherited from mitk::Mapper
static void SetDefaultProperties (DataNode *node, BaseRenderer *renderer=nullptr, bool overwrite=false)
 Set default values of properties used by this mapper on the given node. More...
 

Protected Member Functions

 CrosshairVtkMapper2D ()
 Constructor. Initializes the default gap size. More...
 
 ~CrosshairVtkMapper2D () override
 Destructor. More...
 
void GenerateDataForRenderer (BaseRenderer *renderer) override
 Apply color and opacity properties and create the VTK crosshair geometry. More...
 
void CreateVtkCrosshair (BaseRenderer *renderer)
 Create the VTK crosshair poly data for the given renderer. More...
 
void DrawLine (Point3D p0, Point3D p1, vtkCellArray *lines, vtkPoints *points)
 Draw a line between two 3D points and add it to the given VTK structures. More...
 
void ApplyAllProperties (BaseRenderer *renderer)
 Apply all visual properties (color, opacity, line width) to the crosshair actor. More...
 
void ApplyColorAndOpacityProperties2D (BaseRenderer *renderer, vtkActor2D *actor)
 Apply color and opacity properties to a 2D actor. More...
 
- Protected Member Functions inherited from mitk::VtkMapper
 VtkMapper ()
 
 ~VtkMapper () override
 
- Protected Member Functions inherited from mitk::Mapper
 Mapper ()
 explicit constructor which disallows implicit conversions More...
 
 ~Mapper () override
 virtual destructor in order to derive from this class More...
 
virtual void CalculateTimeStep (BaseRenderer *renderer)
 Updates the time step, which is sometimes needed in subclasses. More...
 
virtual void ResetMapper (BaseRenderer *)
 Reset the mapper (i.e., make sure that nothing is displayed) if no valid data is present. In most cases the reimplemented function disables the according actors (toggling visibility off) More...
 

Protected Attributes

LocalStorageHandler< LocalStorage > m_LSH
 The LocalStorageHandler holds all LocalStorages for the 2D render windows. More...
 
const int defaultGapSize
 The default gap size in pixels for the crosshair center. More...
 
- Protected Attributes inherited from mitk::Mapper
mitk::DataNode * m_DataNode
 

Detailed Description

VTK-based 2D mapper for rendering a crosshair.

CrosshairData is used to retrieve the selected position, which is stored in the processed data node. The crosshair is created by drawing lines through the selected position, adding an additional gap in the center of the crosshair, and creating VTK poly data from the created points and lines.

See also
CrosshairData
CrosshairManager

Definition at line 43 of file mitkCrosshairVtkMapper2D.h.

Constructor & Destructor Documentation

◆ CrosshairVtkMapper2D()

mitk::CrosshairVtkMapper2D::CrosshairVtkMapper2D ( )
protected

Constructor. Initializes the default gap size.

◆ ~CrosshairVtkMapper2D()

mitk::CrosshairVtkMapper2D::~CrosshairVtkMapper2D ( )
overrideprotected

Destructor.

Member Function Documentation

◆ ApplyAllProperties()

void mitk::CrosshairVtkMapper2D::ApplyAllProperties ( BaseRenderer *  renderer)
protected

Apply all visual properties (color, opacity, line width) to the crosshair actor.

Parameters
[in]rendererThe renderer providing property context.

◆ ApplyColorAndOpacityProperties2D()

void mitk::CrosshairVtkMapper2D::ApplyColorAndOpacityProperties2D ( BaseRenderer *  renderer,
vtkActor2D *  actor 
)
protected

Apply color and opacity properties to a 2D actor.

Parameters
[in]rendererThe renderer providing property context.
[in,out]actorThe vtkActor2D to apply properties to.

◆ CreateVtkCrosshair()

void mitk::CrosshairVtkMapper2D::CreateVtkCrosshair ( BaseRenderer *  renderer)
protected

Create the VTK crosshair poly data for the given renderer.

Converts the 3D crosshair position to 2D display coordinates, then draws four line segments with a central gap.

Parameters
[in]rendererThe renderer providing coordinate transformations.

◆ DrawLine()

void mitk::CrosshairVtkMapper2D::DrawLine ( Point3D  p0,
Point3D  p1,
vtkCellArray *  lines,
vtkPoints *  points 
)
protected

Draw a line between two 3D points and add it to the given VTK structures.

Parameters
[in]p0The start point.
[in]p1The end point.
[in,out]linesThe cell array to add the line to.
[in,out]pointsThe points array to add the endpoints to.

◆ GenerateDataForRenderer()

void mitk::CrosshairVtkMapper2D::GenerateDataForRenderer ( BaseRenderer *  renderer)
overrideprotectedvirtual

Apply color and opacity properties and create the VTK crosshair geometry.

Parameters
[in]rendererThe renderer to generate data for.

Reimplemented from mitk::Mapper.

◆ GetInput()

const CrosshairData* mitk::CrosshairVtkMapper2D::GetInput ( ) const

Get the input CrosshairData from the data node.

Returns
The CrosshairData associated with this mapper's data node.

◆ GetVtkProp()

vtkProp* mitk::CrosshairVtkMapper2D::GetVtkProp ( BaseRenderer *  renderer)
overridevirtual

Get the VTK prop assembly for the given renderer.

Parameters
[in]rendererThe renderer whose local storage provides the prop.
Returns
The vtkPropAssembly containing the crosshair actor.

Implements mitk::VtkMapper.

◆ mitkClassMacro()

mitk::CrosshairVtkMapper2D::mitkClassMacro ( CrosshairVtkMapper2D  ,
VtkMapper   
)

◆ New()

static Pointer mitk::CrosshairVtkMapper2D::New ( )
static

◆ SetDefaultProperties()

static void mitk::CrosshairVtkMapper2D::SetDefaultProperties ( DataNode *  node,
BaseRenderer *  renderer = nullptr,
bool  overwrite = false 
)
static

Set default properties for the crosshair data node.

Sets "Line width" and "Crosshair.Gap Size" properties.

Parameters
[in]nodeThe data node to set properties on.
[in]rendererThe renderer for renderer-specific properties. May be nullptr.
[in]overwriteIf true, existing properties are overwritten.

◆ Update()

void mitk::CrosshairVtkMapper2D::Update ( mitk::BaseRenderer *  renderer)
overridevirtual

Check whether this mapper needs to update itself and generate data.

Skips rendering if the data node is not visible in the given renderer or if the data is not of type CrosshairData.

Parameters
[in]rendererThe renderer to update for.

Reimplemented from mitk::Mapper.

Member Data Documentation

◆ defaultGapSize

const int mitk::CrosshairVtkMapper2D::defaultGapSize
protected

The default gap size in pixels for the crosshair center.

Definition at line 157 of file mitkCrosshairVtkMapper2D.h.

◆ m_LSH

LocalStorageHandler<LocalStorage> mitk::CrosshairVtkMapper2D::m_LSH
protected

The LocalStorageHandler holds all LocalStorages for the 2D render windows.

Definition at line 113 of file mitkCrosshairVtkMapper2D.h.


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