[Paraview] Opacity transfer function in pvpython
Ross Gardiner
ross.gardiner at ultrahaptics.com
Fri Jul 21 06:14:43 EDT 2017
Hi,
I’m currently working on a tool that generates Python scripts which, in turn, save a ParaView state. The state can then be loaded in ParaView.
I am experiencing some issues with setting up the LUT for volume rendering of some data. (I’ve already reported one issue that I’m pretty sure is a bug at https://gitlab.kitware.com/paraview/paraview/issues/17616 )
I am able to set the color transfer function and opacity transfer function, and both appear in the UI. However, while the color transfer function works, the opacity transfer function seems to have no effect on rendering whatsoever. After loading the state in ParaView, I can set the entire opacity transfer function to zero and the renderered volume remains completely opaque.
Here’s an example of the Python code I am using:
soundfield = OpenDataFile('my_data.vti')
representation = Show(soundfield)
representation.ColorArrayName = 'ImageScalars'
representation.Representation = 'Volume'
representation.LookupTable = AssignLookupTable(soundfield.PointData['ImageScalars'], 'Cool to Warm')
representation.LookupTable.ScalarOpacityFunction = CreatePiecewiseFunction(Points=[0.0, 0.0, 0.5, 0.0, 1.0, 1.0, 0.5, 0.0])
SaveState('state.pvsm')
Is there anything special I have to do? I’ve looked over the documentation/mailing lists/ListProperties() and I can’t see anything obvious.
Thanks,
Ross
More information about the ParaView
mailing list