[Paraview] Automating loading of binary files

Athanasios Anastasiou athanastasiou at gmail.com
Wed Dec 28 18:17:10 EST 2016


Hello everyone

Many thanks for Paraview.

I have a Python script that processes a series of volumetric data files and
exports simple binary files of three dimensional data of intermediate
stages of computation just for me to check that things are proceeding as
intended.

The "problem" is that to load a volume I have to do lots of clicks (specify
the spacing, the dimensions, the data type, the endianess, etc) and this is
getting tiring after a few times so I decided to automate this by writing a
script.

The script is dead simple and looks roughly like this:

from paraview.simple import *

Q = OpenDataFile("someFile.raw")
Q.SetPropertyWithName("DataScalarType","double")
Q.SetPropertyWithName("DataByteOrder","LittleEndian")
Q.SetPropertyWithName("DataSpacing",(1,2,2))
Q.SetPropertyWithName("DataExtent",(0,31,0,31,0,31))

Show()

#Find the object name, possibly this can be done in a better way
proxyID = Q.GetGlobalIDAsString()
objectName = filter(lambda x:x[1]==proxyID,GetSources().keys())[0]
GetRepresentation(FindSource(objectName[0])).SetPropertyWithName("
Representation","Volume")

At that last step, paraview is crashing. Previously, I simply had it as
GetRepresentation(something).Representation = "Volume" and it was still
crashing.

I would appreciate your help with the following:

1) What is the best practice way to change the representation to Volume?
2) To get the representation, I first allow paraview to create the object
and then look for it via its ID. Is there a way to retrieve it by name?

Looking forward to hearing from you
AA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20161228/9df7a125/attachment.html>


More information about the ParaView mailing list