Change GPU rendering parameters from pythonconsole


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:

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:

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

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