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

Organizes the MITK rendering process within the VTK rendering pipeline. More...

#include <mitkVtkPropRenderer.h>

Inheritance diagram for mitk::VtkPropRenderer:
Collaboration diagram for mitk::VtkPropRenderer:

Public Types

enum  RenderType { Opaque , Translucent , Overlay , Volumetric }
 Enumeration of render pass types. More...
 
enum  PickingMode { WorldPointPicking , PointPicking , CellPicking }
 
typedef std::map< int, Mapper * > MappersMapType
 
- Public Types inherited from mitk::BaseRenderer
enum  StandardMapperSlot { Standard2D , Standard3D }
 Defines which kind of mapper (e.g. 2D or 3D) should be used. More...
 
typedef std::map< vtkRenderWindow *, BaseRenderer * > BaseRendererMapType
 Map type associating vtkRenderWindow pointers with BaseRenderer pointers. More...
 

Public Member Functions

 mitkClassMacro (VtkPropRenderer, BaseRenderer)
 
 mitkNewMacro2Param (VtkPropRenderer, const char *, vtkRenderWindow *)
 
void SetPropertyKeys (vtkInformation *info)
 Store and propagate vtkInformation during rendering. More...
 
int Render (RenderType type)
 Render the scene for the given render type. More...
 
virtual void PrepareRender ()
 Perform all preparations necessary before a VTK Render() call. More...
 
virtual void MakeCurrent ()
 Make the current render window the active OpenGL context. More...
 
void SetDataStorage (mitk::DataStorage *storage) override
 Set the data storage that will be used for rendering. More...
 
void InitRenderer (vtkRenderWindow *renderwindow) override
 Initialize the renderer with the given VTK render window. More...
 
virtual void Update (mitk::DataNode *datatreenode)
 Update a specific data node in the rendering pipeline. More...
 
void SetMapperID (const MapperSlotId mapperId) override
 Set the mapper slot ID to select 2D or 3D mappers. More...
 
void InitSize (int w, int h) override
 Initialize the renderer size. More...
 
void Resize (int w, int h) override
 Resize the renderer. More...
 
 itkSetEnumMacro (PickingMode, PickingMode)
 Set the picking mode. This method is used to set the picking mode for 3D object picking. The user can select one of the three options WorldPointPicking, PointPicking and CellPicking. The first option uses the zBuffer from graphics rendering, the second uses the 3D points from the closest surface mesh, and the third option uses the cells of that mesh. The last option is the slowest, the first one the fastest. However, the first option cannot use transparent data object and the tolerance of the picked position to the selected point should be considered. PointPicking also need a tolerance around the picking position to select the closest point in the mesh. The CellPicker performs very well, if the foreground surface part (i.e. the surfacepart that is closest to the scene's cameras) needs to be picked. More...
 
 itkGetEnumMacro (PickingMode, PickingMode)
 
void PickWorldPoint (const Point2D &displayPoint, Point3D &worldPoint) const override
 Pick a world point from a display position using the current picking mode. More...
 
mitk::DataNode * PickObject (const Point2D &displayPosition, Point3D &worldPosition) const override
 Pick the data node at the given display position. More...
 
bool SetWorldGeometryToDataStorageBounds () override
 
void InitPathTraversal ()
 Used by vtkPointPicker/vtkPicker. This will query a list of all objects in MITK and provide every vtk based mapper to the picker. More...
 
vtkAssemblyPath * GetNextPath ()
 Used by vtkPointPicker/vtkPicker. This will query a list of all objects in MITK and provide every vtk based mapper to the picker. More...
 
int GetNumberOfPaths ()
 Return the number of assembly paths in the current traversal. More...
 
const vtkWorldPointPicker * GetWorldPointPicker () const
 Return the world point picker. More...
 
const vtkPointPicker * GetPointPicker () const
 Return the point picker. More...
 
const vtkCellPicker * GetCellPicker () const
 Return the cell picker. More...
 
virtual void ReleaseGraphicsResources (vtkWindow *renWin)
 Release VTK-based graphics resources. More...
 
MappersMapType GetMappersMap () const
 Return the current map of mappers sorted by layer. More...
 
- Public Member Functions inherited from mitk::BaseRenderer
 mitkClassMacroItkParent (BaseRenderer, itk::Object)
 
 BaseRenderer (const char *name=nullptr, vtkRenderWindow *renderWindow=nullptr)
 Construct a BaseRenderer with an optional name and vtkRenderWindow. More...
 
void RemoveAllLocalStorages ()
 Remove all registered local storages and notify observers via RendererResetEvent. More...
 
void RegisterLocalStorageHandler (BaseLocalStorageHandler *lsh)
 Register a local storage handler with this renderer. More...
 
void UnregisterLocalStorageHandler (BaseLocalStorageHandler *lsh)
 Unregister a previously registered local storage handler. More...
 
virtual DataStorage::Pointer GetDataStorage () const
 Get the DataStorage used by this renderer. More...
 
vtkRenderWindow * GetRenderWindow () const
 Get the vtkRenderWindow associated with this renderer. More...
 
vtkRenderer * GetVtkRenderer () const
 Get the underlying vtkRenderer used for VTK rendering. More...
 
Dispatcher::Pointer GetDispatcher () const
 Get the dispatcher, which handles events for this base renderer. More...
 
virtual void DrawOverlayMouse (Point2D &)
 Draw an overlay mouse cursor at the given position. More...
 
virtual void SetWorldTimeGeometry (const TimeGeometry *geometry)
 Set the world time geometry using the given TimeGeometry. More...
 
virtual const TimeGeometry * GetWorldTimeGeometry ()
 
virtual void SetInteractionReferenceGeometry (const TimeGeometry *geometry)
 Set the interaction reference world time geometry using the given TimeGeometry. More...
 
virtual const TimeGeometry * GetInteractionReferenceGeometry ()
 Get the current interaction reference geometry. More...
 
virtual bool GetReferenceGeometryAligned ()
 Return if the reference geometry aligns with the base renderer's world geometry. If true, the interaction reference geometry aligns with the base renderer's current world geometry. False otherwise. More...
 
virtual const BaseGeometry * GetCurrentWorldGeometry ()
 Get the current time-extracted 3D-geometry. More...
 
virtual const PlaneGeometry * GetCurrentWorldPlaneGeometry ()
 Get the current slice-extracted 2D-geometry. More...
 
virtual void SetSlice (unsigned int slice)
 Set the slice that should be used for geometry extraction. More...
 
virtual unsigned int GetSlice () const
 
virtual void SetTimeStep (unsigned int timeStep)
 Set the timestep that should be used for geometry extraction. More...
 
virtual unsigned int GetTimeStep () const
 
TimeStepType GetTimeStep (const BaseData *data) const
 Get the timestep of a BaseData object which exists at the time of the currently displayed content. More...
 
ScalarType GetTime () const
 Get the time in ms of the currently display content (geometry). More...
 
virtual void SetGeometry (const itk::EventObject &geometrySliceEvent)
 Set the world time geometry using the geometry of the given event. More...
 
virtual void UpdateGeometry (const itk::EventObject &geometrySliceEvent)
 Set the current world plane geometry using the existing current world geometry. More...
 
virtual void SetGeometrySlice (const itk::EventObject &geometrySliceEvent)
 Set the current slice using "SetSlice" and update the current world geometry and the current world plane geometry. More...
 
virtual void SetGeometryTime (const itk::EventObject &geometryTimeEvent)
 Set the current time using "SetTimeStep" and update the current world geometry and the current world plane geometry. More...
 
virtual DataNode * GetCurrentWorldPlaneGeometryNode ()
 
void SendUpdateSlice ()
 Modify the update time of the current world plane geometry and force reslicing. More...
 
virtual unsigned long GetCurrentWorldPlaneGeometryUpdateTime ()
 Get timestamp of the update time of the current world plane geometry. More...
 
virtual unsigned long GetTimeStepUpdateTime ()
 Get timestamp of the update time of the current timestep. More...
 
virtual MapperSlotId GetMapperID ()
 Get the currently used mapperID. More...
 
virtual MapperSlotId GetMapperID () const
 
virtual int * GetSize () const
 Get the size of the render window in pixels. More...
 
virtual int * GetViewportSize () const
 Get the size of the VTK viewport in pixels. More...
 
void SetSliceNavigationController (SliceNavigationController *SlicenavigationController)
 Replace the current SliceNavigationController. More...
 
virtual CameraController * GetCameraController ()
 Get the CameraController for this renderer. More...
 
virtual SliceNavigationController * GetSliceNavigationController ()
 Get the SliceNavigationController for this renderer. More...
 
virtual CameraRotationController * GetCameraRotationController ()
 Get the CameraRotationController for this renderer. More...
 
virtual bool GetEmptyWorldGeometry ()
 Return whether the current world geometry is empty (has zero extent). More...
 
virtual bool GetKeepDisplayedRegion ()
 Getter/Setter for defining if the displayed region should be shifted or rescaled if the render window is resized. More...
 
virtual void SetKeepDisplayedRegion (bool _arg)
 
const char * GetName () const
 Return the name of the base renderer. More...
 
int GetSizeX () const
 Return the size in x-direction of the base renderer. More...
 
int GetSizeY () const
 Return the size in y-direction of the base renderer. More...
 
const double * GetBounds () const
 Return the bounds of the bounding box of the current world geometry (time-extracted 3D-geometry). More...
 
void RequestUpdate ()
 Request an asynchronous rendering update for this render window via the RenderingManager. More...
 
void ForceImmediateUpdate ()
 Force an immediate synchronous rendering update for this render window. More...
 
unsigned int GetNumberOfVisibleLODEnabledMappers () const
 Return the number of mappers which are visible and have level-of-detail rendering enabled. More...
 
void DisplayToWorld (const Point2D &displayPoint, Point3D &worldIndex) const
 Convert a display point to a 3D world coordinate. More...
 
void DisplayToPlane (const Point2D &displayPoint, Point2D &planePointInMM) const
 Convert a display point to a 2D plane coordinate in millimeters. More...
 
void WorldToDisplay (const Point3D &worldIndex, Point2D &displayPoint) const
 Convert a 3D world coordinate to a 2D display point. More...
 
void WorldToView (const Point3D &worldIndex, Point2D &viewPoint) const
 Convert a 3D world coordinate to a 2D viewport point. More...
 
void PlaneToDisplay (const Point2D &planePointInMM, Point2D &displayPoint) const
 Convert a 2D plane coordinate in millimeters to a 2D display point. More...
 
void PlaneToView (const Point2D &planePointInMM, Point2D &viewPoint) const
 Convert a 2D plane coordinate in millimeters to a 2D viewport point. More...
 
double GetScaleFactorMMPerDisplayUnit () const
 Get the scale factor relating millimeters to display pixels. More...
 
Point2D GetDisplaySizeInMM () const
 Get the size of the render window in millimeters. More...
 
Point2D GetViewportSizeInMM () const
 Get the size of the VTK viewport in millimeters. More...
 
Point2D GetOriginInMM () const
 Get the origin of the viewport in plane coordinates (millimeters). More...
 
virtual bool GetConstrainZoomingAndPanning () const
 Get whether zooming and panning are constrained to the displayed geometry. More...
 
virtual void SetConstrainZoomingAndPanning (bool constrain)
 Enable or disable constraining of zooming and panning. More...
 

Static Public Member Functions

static bool useImmediateModeRendering ()
 Return whether immediate mode rendering is used. More...
 
- Static Public Member Functions inherited from mitk::BaseRenderer
static BaseRenderer * GetInstance (vtkRenderWindow *renderWindow)
 Get the BaseRenderer instance associated with the given vtkRenderWindow. More...
 
static void AddInstance (vtkRenderWindow *renderWindow, BaseRenderer *baseRenderer)
 Register a BaseRenderer instance for the given vtkRenderWindow. More...
 
static void RemoveInstance (vtkRenderWindow *renderWindow)
 Remove the BaseRenderer registration for the given vtkRenderWindow. More...
 
static BaseRenderer * GetByName (const std::string &name)
 Find a BaseRenderer by its name. More...
 
static vtkRenderWindow * GetRenderWindowByName (const std::string &name)
 Find a vtkRenderWindow by the name of its associated BaseRenderer. More...
 
static BaseRendererMapType GetSpecificRenderWindows (MapperSlotId mapper)
 Get a map of all BaseRenderers that use the specified mapper type. More...
 
static BaseRendererMapType GetAll2DRenderWindows ()
 Convenience function: Get a map of all 2D RenderWindows. More...
 
static BaseRendererMapType GetAll3DRenderWindows ()
 Convenience function: Get a map of all 3D RenderWindows. More...
 

Protected Member Functions

 VtkPropRenderer (const char *name="VtkPropRenderer", vtkRenderWindow *renWin=nullptr)
 
 ~VtkPropRenderer () override
 
void Update () override
 
virtual void UpdatePaths ()
 
- Protected Member Functions inherited from mitk::BaseRenderer
 ~BaseRenderer () override
 
void UpdateCurrentGeometries ()
 
virtual void SetCurrentWorldPlaneGeometry (const PlaneGeometry *geometry2d)
 
virtual void SetCurrentWorldGeometry (const BaseGeometry *geometry)
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 

Static Protected Member Functions

static void RenderingCallback (vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)
 

Additional Inherited Members

- Static Public Attributes inherited from mitk::BaseRenderer
static BaseRendererMapType baseRendererMap
 Static map holding all registered BaseRenderer instances, keyed by their vtkRenderWindow. More...
 
- Protected Types inherited from mitk::BaseRenderer
typedef std::set< Mapper * > LODEnabledMappersType
 
- Protected Attributes inherited from mitk::BaseRenderer
vtkRenderWindow * m_RenderWindow
 
vtkRenderer * m_VtkRenderer
 
MapperSlotId m_MapperID
 
DataStorage::Pointer m_DataStorage
 
unsigned long m_LastUpdateTime
 
CameraController::Pointer m_CameraController
 
CameraRotationController::Pointer m_CameraRotationController
 
SliceNavigationController::Pointer m_SliceNavigationController
 
PlaneGeometryData::Pointer m_CurrentWorldPlaneGeometryData
 
DataNode::Pointer m_CurrentWorldPlaneGeometryNode
 
unsigned long m_CurrentWorldPlaneGeometryTransformTime
 
std::string m_Name
 
double m_Bounds [6]
 
bool m_EmptyWorldGeometry
 
unsigned int m_NumberOfVisibleLODEnabledMappers
 
std::list< BaseLocalStorageHandler * > m_RegisteredLocalStorageHandlers
 
bool m_ConstrainZoomingAndPanning
 

Detailed Description

Organizes the MITK rendering process within the VTK rendering pipeline.

The MITK rendering process is completely integrated into the VTK rendering pipeline. vtkMitkRenderProp is a custom vtkProp derived class that implements the rendering interface between MITK and VTK. It redirects render() calls to VtkPropRenderer, which is responsible for rendering the data tree nodes.

VtkPropRenderer replaces the old OpenGLRenderer.

Definition at line 50 of file mitkVtkPropRenderer.h.

Member Typedef Documentation

◆ MappersMapType

Definition at line 63 of file mitkVtkPropRenderer.h.

Member Enumeration Documentation

◆ PickingMode

Enumerator
WorldPointPicking 
PointPicking 
CellPicking 

Definition at line 135 of file mitkVtkPropRenderer.h.

◆ RenderType

Enumeration of render pass types.

Enumerator
Opaque 
Translucent 
Overlay 
Volumetric 

Definition at line 66 of file mitkVtkPropRenderer.h.

Constructor & Destructor Documentation

◆ VtkPropRenderer()

mitk::VtkPropRenderer::VtkPropRenderer ( const char *  name = "VtkPropRenderer",
vtkRenderWindow *  renWin = nullptr 
)
protected

◆ ~VtkPropRenderer()

mitk::VtkPropRenderer::~VtkPropRenderer ( )
overrideprotected

Member Function Documentation

◆ GetCellPicker()

const vtkCellPicker* mitk::VtkPropRenderer::GetCellPicker ( ) const

Return the cell picker.

Returns
Pointer to the internal vtkCellPicker.

◆ GetMappersMap()

MappersMapType mitk::VtkPropRenderer::GetMappersMap ( ) const

Return the current map of mappers sorted by layer.

Returns
The mappers map keyed by layer index.

◆ GetNextPath()

vtkAssemblyPath* mitk::VtkPropRenderer::GetNextPath ( )

Used by vtkPointPicker/vtkPicker. This will query a list of all objects in MITK and provide every vtk based mapper to the picker.

◆ GetNumberOfPaths()

int mitk::VtkPropRenderer::GetNumberOfPaths ( )

Return the number of assembly paths in the current traversal.

Returns
The number of paths.

◆ GetPointPicker()

const vtkPointPicker* mitk::VtkPropRenderer::GetPointPicker ( ) const

Return the point picker.

Returns
Pointer to the internal vtkPointPicker.

◆ GetWorldPointPicker()

const vtkWorldPointPicker* mitk::VtkPropRenderer::GetWorldPointPicker ( ) const

Return the world point picker.

Returns
Pointer to the internal vtkWorldPointPicker.

◆ InitPathTraversal()

void mitk::VtkPropRenderer::InitPathTraversal ( )

Used by vtkPointPicker/vtkPicker. This will query a list of all objects in MITK and provide every vtk based mapper to the picker.

◆ InitRenderer()

void mitk::VtkPropRenderer::InitRenderer ( vtkRenderWindow *  renderwindow)
overridevirtual

Initialize the renderer with the given VTK render window.

Parameters
[in]renderwindowThe VTK render window to initialize with.

Reimplemented from mitk::BaseRenderer.

◆ InitSize()

void mitk::VtkPropRenderer::InitSize ( int  w,
int  h 
)
overridevirtual

Initialize the renderer size.

Parameters
[in]wWidth in pixels.
[in]hHeight in pixels.

Reimplemented from mitk::BaseRenderer.

◆ itkGetEnumMacro()

mitk::VtkPropRenderer::itkGetEnumMacro ( PickingMode  ,
PickingMode   
)

◆ itkSetEnumMacro()

mitk::VtkPropRenderer::itkSetEnumMacro ( PickingMode  ,
PickingMode   
)

Set the picking mode. This method is used to set the picking mode for 3D object picking. The user can select one of the three options WorldPointPicking, PointPicking and CellPicking. The first option uses the zBuffer from graphics rendering, the second uses the 3D points from the closest surface mesh, and the third option uses the cells of that mesh. The last option is the slowest, the first one the fastest. However, the first option cannot use transparent data object and the tolerance of the picked position to the selected point should be considered. PointPicking also need a tolerance around the picking position to select the closest point in the mesh. The CellPicker performs very well, if the foreground surface part (i.e. the surfacepart that is closest to the scene's cameras) needs to be picked.

◆ MakeCurrent()

virtual void mitk::VtkPropRenderer::MakeCurrent ( )
virtual

Make the current render window the active OpenGL context.

◆ mitkClassMacro()

mitk::VtkPropRenderer::mitkClassMacro ( VtkPropRenderer  ,
BaseRenderer   
)

◆ mitkNewMacro2Param()

mitk::VtkPropRenderer::mitkNewMacro2Param ( VtkPropRenderer  ,
const char *  ,
vtkRenderWindow *   
)

◆ PickObject()

mitk::DataNode* mitk::VtkPropRenderer::PickObject ( const Point2D &  displayPosition,
Point3D &  worldPosition 
) const
overridevirtual

Pick the data node at the given display position.

Parameters
[in]displayPositionThe 2D display position to pick from.
[out]worldPositionThe 3D world position of the picked object.
Returns
The picked DataNode, or nullptr if nothing was picked.

Reimplemented from mitk::BaseRenderer.

◆ PickWorldPoint()

void mitk::VtkPropRenderer::PickWorldPoint ( const Point2D &  displayPoint,
Point3D &  worldPoint 
) const
overridevirtual

Pick a world point from a display position using the current picking mode.

Parameters
[in]displayPointThe 2D display position to pick from.
[out]worldPointThe resulting 3D world coordinate.

Implements mitk::BaseRenderer.

◆ PrepareRender()

virtual void mitk::VtkPropRenderer::PrepareRender ( )
virtual

Perform all preparations necessary before a VTK Render() call.

◆ ReleaseGraphicsResources()

virtual void mitk::VtkPropRenderer::ReleaseGraphicsResources ( vtkWindow *  renWin)
virtual

Release VTK-based graphics resources.

Called by vtkMitkRenderProp::ReleaseGraphicsResources.

Parameters
[in]renWinThe VTK window whose resources should be released.

◆ Render()

int mitk::VtkPropRenderer::Render ( RenderType  type)

Render the scene for the given render type.

Called by vtkMitkRenderProp during VTK rendering.

Parameters
[in]typeThe render pass type (Opaque, Translucent, Overlay, or Volumetric).
Returns
The number of props rendered.

◆ RenderingCallback()

static void mitk::VtkPropRenderer::RenderingCallback ( vtkObject *  caller,
unsigned long  eid,
void *  clientdata,
void *  calldata 
)
staticprotected

◆ Resize()

void mitk::VtkPropRenderer::Resize ( int  w,
int  h 
)
overridevirtual

Resize the renderer.

Parameters
[in]wNew width in pixels.
[in]hNew height in pixels.

Reimplemented from mitk::BaseRenderer.

◆ SetDataStorage()

void mitk::VtkPropRenderer::SetDataStorage ( mitk::DataStorage *  storage)
overridevirtual

Set the data storage that will be used for rendering.

Parameters
[in]storageThe data storage to use.

Reimplemented from mitk::BaseRenderer.

◆ SetMapperID()

void mitk::VtkPropRenderer::SetMapperID ( const MapperSlotId  mapperId)
overridevirtual

Set the mapper slot ID to select 2D or 3D mappers.

Parameters
[in]mapperIdThe mapper slot identifier.

Reimplemented from mitk::BaseRenderer.

◆ SetPropertyKeys()

void mitk::VtkPropRenderer::SetPropertyKeys ( vtkInformation *  info)

Store and propagate vtkInformation during rendering.

Parameters
[in]infoThe VTK information object to propagate to mappers.

◆ SetWorldGeometryToDataStorageBounds()

bool mitk::VtkPropRenderer::SetWorldGeometryToDataStorageBounds ( )
overridevirtual

This method calculates the bounds of the DataStorage (if it contains any valid data), creates a geometry from these bounds and sets it as world geometry of the renderer.

Call this method to re-initialize the renderer to the current DataStorage (e.g. after loading an additional dataset), to ensure that the view is aligned correctly.

Reimplemented from mitk::BaseRenderer.

◆ Update() [1/2]

void mitk::VtkPropRenderer::Update ( )
overrideprotectedvirtual

Implements mitk::BaseRenderer.

◆ Update() [2/2]

virtual void mitk::VtkPropRenderer::Update ( mitk::DataNode *  datatreenode)
virtual

Update a specific data node in the rendering pipeline.

Parameters
[in]datatreenodeThe data node to update.

◆ UpdatePaths()

virtual void mitk::VtkPropRenderer::UpdatePaths ( )
protectedvirtual

◆ useImmediateModeRendering()

static bool mitk::VtkPropRenderer::useImmediateModeRendering ( )
static

Return whether immediate mode rendering is used.

Returns
True if immediate mode rendering is enabled.

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