Is it possible to render a scripted text or message in Virtual Reality Environment in addition with Rendered label map Model ?
Markups would be the most convenient way of displaying labels, but they use 2D text actors, which I think are rendered with ghosting. However, there are many 3D text actors that you can add to the scene, for example:
viewIndex = 0
label = vtk.vtkFlagpoleLabel()
label.SetInput("My label")
renderWindow = slicer.app.layoutManager().threeDWidget(viewIndex).threeDView().renderWindow()
renderer = renderWindow.GetRenderers().GetFirstRenderer()
renderer.AddActor(label)
renderer.Render()
You need to replace viewIndex
with the index of the virtual reality view.
thank you Andras, I am getting this error while trying to use vtk.FlagpoleLabel(). Do I need to import any other library beside vtk to work it out ?
vtk.vtkFlagpoleLabel()
Traceback (most recent call last):
File “”, line 1, in
AttributeError: module ‘vtkmodules.all’ has no attribute ‘vtkFlagpoleLabel’
Using slicer 4.11.0
Thank you !!
vtkFlagpoleLabel has been added to VTK recently, so it is only available in Slicer Preview Releases (VTK9), but there are other similar 3D text actors in VTK8 that you can use in Slicer-4.11.