Medical Imaging Interaction Toolkit  2023.12.99-7a59bd54
Medical Imaging Interaction Toolkit
mitk::VtkPropRenderer Class Reference

VtkPropRenderer. More...

#include <mitkVtkPropRenderer.h>

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

Public Types

enum  RenderType { Opaque, Translucent, Overlay, Volumetric }
 
enum  PickingMode { WorldPointPicking, PointPicking, CellPicking }
 
typedef VtkPropRenderer Self
 
typedef BaseRenderer Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 
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
 
typedef BaseRenderer Self
 
typedef itk::Object Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 

Public Member Functions

virtual std::vector< std::string > GetClassHierarchy () const override
 
virtual const char * GetClassName () const
 
void SetPropertyKeys (vtkInformation *info)
 Store/propagate vtkInformation during rendering. More...
 
int Render (RenderType type)
 
virtual void PrepareRender ()
 This methods contains all method neceassary before a VTK Render() call. More...
 
virtual void MakeCurrent ()
 
void SetDataStorage (mitk::DataStorage *storage) override
 set the datastorage that will be used for rendering More...
 
void InitRenderer (vtkRenderWindow *renderwindow) override
 Initialize the base renderer with a vtk render window. Set the new renderer for the camera controller. More...
 
virtual void Update (mitk::DataNode *datatreenode)
 
void SetMapperID (const MapperSlotId mapperId) override
 Set the used mapperID. More...
 
void InitSize (int w, int h) override
 Set the initial size for the render window. More...
 
void Resize (int w, int h) override
 Set a new size for the render window. 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 coordinate (x,y,z) given a display coordinate (x,y). More...
 
mitk::DataNodePickObject (const Point2D &displayPosition, Point3D &worldPosition) const override
 Determines the object (mitk::DataNode) closest to the current position by means of picking. More...
 
int WriteSimpleText (std::string text, double posX, double posY, double color1=0.0, double color2=1.0, double color3=0.0, float opacity=1.0)
 
vtkTextProperty * GetTextLabelProperty (int text_id)
 CGetTextLabelProperty an be used in order to get a vtkTextProperty for a specific text_id. This property enables the setup of font, font size, etc. 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 ()
 
const vtkWorldPointPicker * GetWorldPointPicker () const
 
const vtkPointPicker * GetPointPicker () const
 
const vtkCellPicker * GetCellPicker () const
 
virtual void ReleaseGraphicsResources (vtkWindow *renWin)
 Release vtk-based graphics resources. Called by vtkMitkRenderProp::ReleaseGraphicsResources. More...
 
MappersMapType GetMappersMap () const
 
- Public Member Functions inherited from mitk::BaseRenderer
 BaseRenderer (const char *name=nullptr, vtkRenderWindow *renderWindow=nullptr)
 
void RemoveAllLocalStorages ()
 
void RegisterLocalStorageHandler (BaseLocalStorageHandler *lsh)
 
void UnregisterLocalStorageHandler (BaseLocalStorageHandler *lsh)
 
virtual DataStorage::Pointer GetDataStorage () const
 
vtkRenderWindow * GetRenderWindow () const
 
vtkRenderer * GetVtkRenderer () const
 
Dispatcher::Pointer GetDispatcher () const
 Get the dispatcher, which handles events for this base renderer. More...
 
virtual void DrawOverlayMouse (Point2D &)
 
virtual void SetWorldTimeGeometry (const TimeGeometry *geometry)
 Set the world time geometry using the given TimeGeometry. More...
 
virtual const TimeGeometryGetWorldTimeGeometry ()
 
virtual void SetInteractionReferenceGeometry (const TimeGeometry *geometry)
 Set the interaction reference world time geometry using the given TimeGeometry. More...
 
virtual const TimeGeometryGetInteractionReferenceGeometry ()
 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 BaseGeometryGetCurrentWorldGeometry ()
 Get the current time-extracted 3D-geometry. More...
 
virtual const PlaneGeometryGetCurrentWorldPlaneGeometry ()
 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 DataNodeGetCurrentWorldPlaneGeometryNode ()
 
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
 
virtual int * GetViewportSize () const
 
void SetSliceNavigationController (SliceNavigationController *SlicenavigationController)
 
virtual CameraControllerGetCameraController ()
 
virtual SliceNavigationControllerGetSliceNavigationController ()
 
virtual CameraRotationControllerGetCameraRotationController ()
 
virtual bool GetEmptyWorldGeometry ()
 
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 ()
 
void ForceImmediateUpdate ()
 
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 the 3D world index using the geometry of the renderWindow. More...
 
void DisplayToPlane (const Point2D &displayPoint, Point2D &planePointInMM) const
 Convert a display point to the 2D world index, mapped onto the display plane using the geometry of the renderWindow. More...
 
void WorldToDisplay (const Point3D &worldIndex, Point2D &displayPoint) const
 Convert a 3D world index to the display point using the geometry of the renderWindow. More...
 
void WorldToView (const Point3D &worldIndex, Point2D &viewPoint) const
 Convert a 3D world index to the point on the viewport using the geometry of the renderWindow. More...
 
void PlaneToDisplay (const Point2D &planePointInMM, Point2D &displayPoint) const
 Convert a 2D plane coordinate to the display point using the geometry of the renderWindow. More...
 
void PlaneToView (const Point2D &planePointInMM, Point2D &viewPoint) const
 Convert a 2D plane coordinate to the point on the viewport using the geometry of the renderWindow. More...
 
double GetScaleFactorMMPerDisplayUnit () const
 
Point2D GetDisplaySizeInMM () const
 
Point2D GetViewportSizeInMM () const
 
Point2D GetOriginInMM () const
 
virtual bool GetConstrainZoomingAndPanning () const
 
virtual void SetConstrainZoomingAndPanning (bool constrain)
 

Static Public Member Functions

static const char * GetStaticNameOfClass ()
 
static Pointer New (const char *_arga, vtkRenderWindow *_argb)
 
static bool useImmediateModeRendering ()
 
- Static Public Member Functions inherited from mitk::BaseRenderer
static BaseRendererGetInstance (vtkRenderWindow *renderWindow)
 
static void AddInstance (vtkRenderWindow *renderWindow, BaseRenderer *baseRenderer)
 
static void RemoveInstance (vtkRenderWindow *renderWindow)
 
static BaseRendererGetByName (const std::string &name)
 
static vtkRenderWindow * GetRenderWindowByName (const std::string &name)
 
static BaseRendererMapType GetSpecificRenderWindows (MapperSlotId mapper)
 Get a map of specific RenderWindows. 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...
 
static const char * GetStaticNameOfClass ()
 

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
 
- 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

VtkPropRenderer.

VtkPropRenderer organizes the MITK rendering process. The MITK rendering process is completely integrated into the VTK rendering pipeline. The vtkMitkRenderProp is a custom vtkProp derived class, which implements the rendering interface between MITK and VTK. It redirects render() calls to the VtkPropRenderer, which is responsible for rendering of the datatreenodes. VtkPropRenderer replaces the old OpenGLRenderer.

See also
rendering

Definition at line 55 of file mitkVtkPropRenderer.h.

Member Typedef Documentation

◆ ConstPointer

◆ MappersMapType

Definition at line 66 of file mitkVtkPropRenderer.h.

◆ Pointer

◆ Self

◆ Superclass

Member Enumeration Documentation

◆ PickingMode

Enumerator
WorldPointPicking 
PointPicking 
CellPicking 

Definition at line 102 of file mitkVtkPropRenderer.h.

◆ RenderType

Enumerator
Opaque 
Translucent 
Overlay 
Volumetric 

Definition at line 71 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

◆ GetClassHierarchy()

virtual std::vector<std::string> mitk::VtkPropRenderer::GetClassHierarchy ( ) const
inlineoverridevirtual

Reimplemented from mitk::BaseRenderer.

Definition at line 65 of file mitkVtkPropRenderer.h.

◆ GetClassName()

virtual const char* mitk::VtkPropRenderer::GetClassName ( ) const
virtual

Reimplemented from mitk::BaseRenderer.

◆ GetMappersMap()

MappersMapType mitk::VtkPropRenderer::GetMappersMap ( ) const

◆ 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 ( )

◆ GetPointPicker()

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

◆ GetStaticNameOfClass()

static const char* mitk::VtkPropRenderer::GetStaticNameOfClass ( )
inlinestatic

Definition at line 65 of file mitkVtkPropRenderer.h.

◆ GetTextLabelProperty()

vtkTextProperty* mitk::VtkPropRenderer::GetTextLabelProperty ( int  text_id)

CGetTextLabelProperty an be used in order to get a vtkTextProperty for a specific text_id. This property enables the setup of font, font size, etc.

Parameters
text_idthe id of the text property.
Deprecated:
(as of 2015_05) Please use mitkTextOverlay2D instead. See mitkTextOverlay2DRenderingTest for an example.

◆ GetWorldPointPicker()

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

◆ 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 base renderer with a vtk render window. Set the new renderer for the camera controller.

Reimplemented from mitk::BaseRenderer.

◆ InitSize()

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

Set the initial size for the render window.

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

◆ New()

static Pointer mitk::VtkPropRenderer::New ( const char *  _arga,
vtkRenderWindow *  _argb 
)
inlinestatic

Definition at line 66 of file mitkVtkPropRenderer.h.

◆ PickObject()

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

Determines the object (mitk::DataNode) closest to the current position by means of picking.

Warning
Implementation currently empty for 2D rendering; intended to be implemented for 3D renderers.

Reimplemented from mitk::BaseRenderer.

◆ PickWorldPoint()

void mitk::VtkPropRenderer::PickWorldPoint ( const Point2D diplayPosition,
Point3D worldPosition 
) const
overridevirtual

Pick a world coordinate (x,y,z) given a display coordinate (x,y).

Warning
Not implemented; has to be overwritten in subclasses.

Implements mitk::BaseRenderer.

◆ PrepareRender()

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

This methods contains all method neceassary before a VTK Render() call.

◆ ReleaseGraphicsResources()

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

Release vtk-based graphics resources. Called by vtkMitkRenderProp::ReleaseGraphicsResources.

◆ Render()

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

◆ 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

Set a new size for the render window.

Reimplemented from mitk::BaseRenderer.

◆ SetDataStorage()

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

set the datastorage that will be used for rendering

Reimplemented from mitk::BaseRenderer.

◆ SetMapperID()

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

Set the used mapperID.

Reimplemented from mitk::BaseRenderer.

◆ SetPropertyKeys()

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

Store/propagate vtkInformation during rendering.

◆ 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

◆ UpdatePaths()

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

◆ useImmediateModeRendering()

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

◆ WriteSimpleText()

int mitk::VtkPropRenderer::WriteSimpleText ( std::string  text,
double  posX,
double  posY,
double  color1 = 0.0,
double  color2 = 1.0,
double  color3 = 0.0,
float  opacity = 1.0 
)
@brief WriteSimpleText Write a text in a renderwindow.

Writes some 2D text as overlay. Function returns an unique int Text_ID for each call, which can be used via the

GetTextLabelProperty(int text_id) function in order to get a vtkTextProperty. This property enables the setup of font, font size, etc.

\xrefitem deprecatedSince2015_05 "" "Functions deprecated as of 2015_05" \deprecated (as of 2015_05) Please use mitkTextOverlay2D instead.
See mitkTextOverlay2DRenderingTest for an example.

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