Change GPU rendering parameters from pythonconsole

Hi,

I would like to change the Rendering to “VTK GPU Ray Casting” as well as manipulate the “GPU Memory Size”, “Quality Control”, and “Interactive Speed” from python.

Can someone help me do this?

thank you!

Hi -

You need to get the vtkMRMLVolumeRenderingDisplayNode from the volume and you can set the properties on it.

Something like if you download MRHead sample data and make it visible in VolumeRendering:

n = getNode('MRHead')
dn = n.GetNthDisplayNode(1)

dn will have methods to control the rendering. They don’t always have the same names as the GUI.

Here are the methods:

http://apidocs.slicer.org/master/classvtkMRMLVolumeRenderingDisplayNode.html

The type of rendering is controlled by whether a CPU or GPU concrete subclasses is in the list for the the Volume you can control.

Here’s where they are manipulated by the GUI:

https://github.com/Slicer/Slicer/blob/eefeac9286f48552e8418a11f412b2823a09b407/Modules/Loadable/VolumeRendering/Widgets/qSlicerGPURayCastVolumeRenderingPropertiesWidget.cxx

and here’s where they are used in the rendering:

https://github.com/Slicer/Slicer/blob/ff4a605ef55fdda4fbd8c20cee41e4b184461f72/Modules/Loadable/VolumeRendering/MRMLDM/vtkMRMLVolumeRenderingDisplayableManager.cxx

Hope you can figure out what you need from the context there.

-Steve