[Paraview] Python command to rescale data range

Jean Favre jfavre at cscs.ch
Fri Jan 23 05:49:09 EST 2009


Charles-André wrote:
> I would need your lights on a small but annoying problem that I have
> with Paraview 3.4.0. I use a python script to load and display a
> preformatted state. It all works fine except that the color scale
> doesn't automatically rescale to fit data range, even though the
> corresponding checkbox is selected. I would like to find the python
> command equivalent to a simple click on the icon "Rescale data to
> range". Does anyone know such command ?

This is not "a simple click", but the following python code works for me:

#get the proxy to your object, example

pm = servermanager.ProxyManager()
slice = pm.GetProxy('sources', 'Slice1')

#get the data range

range =
slice.GetDataInformation().GetPointDataInformation().GetArrayInformation(0).GetComponentRange(0)

# find a proxy to the representation of your object
# iterate until you find the right one, e.g.

print pm.GetProxiesInGroup("representations")
#  once you know your proxy, e.g.

rep = pm.GetProxy("representations", "DataRepresentation4")

# get its lookuptable and the RGBpoints array

table = rep.LookupTable.GetData().RGBPoints
# you can now set it to your data range

table[0] = range[0]
table[4] = range[1]



Your mileage will vary. Error checking is left as an exercise

--
Jean
Swiss National Supercomputing Centre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20090123/55177359/attachment.htm>


More information about the ParaView mailing list