[Paraview] Changing displayed dataset in python interface

Louie Cardone-Noott louie.cardone-noott at linacre.ox.ac.uk
Wed Jul 9 08:18:13 EDT 2014


Hi paraview list,

First post here - hope I'm doing it right!

I've been fighting with the python interface to generate images from
several views (rotated around) of a number of datasets. I'm stuck on the
latter point. The outline of my script is as follows:

# Start pseudo-code
# Load
RenderView1 = CreateRenderView()
results_pvtu = XMLPartitionedUnstructuredGridReader( ... )

# Make two lookup tables and scalar bars
UpstrokeLookupTable = GetLookupTableForArray( "UpstrokeTimeMap_0_000000",
... )
UpstrokeBarRep = CreateScalarBar( ... )
UpstrokeBarRep.LookupTable = UpstrokeLookupTable
ApdLookupTable = GetLookupTableForArray( "Apd_90_0_Map_000000", ... )
ApdBarRep = CreateScalarBar( ... )
ApdBarRep.LookupTable = ApdLookupTable

# Threshold results first
Threshold1 = Threshold()
Show()
ResetCamera() # To get the zoom roughly right

# Display first dataset
threshold_rep.ColorArrayName = 'UpstrokeTimeMap_0_000000'
threshold_rep.LookupTable = UpstrokeLookupTable
RenderView1.Representations.append(UpstrokeBarRep)

# Rotate camera and save a series of images
RenderView1.CameraViewUp = [...]
RenderView1.CameraClippingRange = [...]
RenderView1.CameraPosition = [...]
Render()
WriteImage(...)

# Delete first scalar bar and change dataset
Delete(RenderView1.Representations[1]) # 0 is the results, 1 is the scalar
bar
threshold_rep.ColorArrayName = 'Apd_90_0_Map_000000'
threshold_rep.LookupTable = ApdLookupTable
RenderView1.Representations.append(ApdBarRep)

# Rotate camera and save a series of images
RenderView1.CameraViewUp ... etc.

# End pseudo-code

The images from the first dataset ('UpstrokeTimeMap_0_000000') look normal,
but in the second set ('Apd_90_0_Map_000000') the colours are all weird and
jaggy with similarities to both datasets, a bit like it's trying to display
them both.

The python trace doesn't help as it generates similar code to the above.

I was wondering if there might be a smarter way to do this. The
"representations and views" bit of the python guide looks promising but I
don't quite see how.
http://www.paraview.org/Wiki/ParaView/Python_Scripting#Representations_and_Views

Thanks for assistance.

Louie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20140709/37952576/attachment.html>


More information about the ParaView mailing list