Hi,
I’ve been using a python script to post-process and visualise large structured
grid files. It works great but the grids I am visualising are of different
dimensions (let say either 512x128x512, or 1024x256x1024).
In the script pipeline - see snippet below - I extract a subset (top cell
layer in the Y direction) from the whole dataset, using ExtractSubset filter.
At this stage for the 2 input files dimensions above, I need to modify the
script and correctly set extractSubset1.VOI values manually.
Is there a method that I could use in the script to get the dimensions (or
extent) of the structured grid, so I can make the script extract the top layer
I’m interested in for any grid dimension?
<snip>
from paraview.simple import *
inputPvts = XMLPartitionedStructuredGridReader(FileName=[fname])
inputPvts.PointArrayStatus = ['velocity']
# get active view
renderView1 = GetActiveViewOrCreate('RenderView')
renderView1.ResetCamera()
#get the 4 uppermost cells
extractSubset1 = ExtractSubset(Input=inputPvts)
extractSubset1.VOI = [0, 512, 127, 128, 0, 512]
extractSubset1.SampleRateI = 1
extractSubset1.SampleRateJ = 1
extractSubset1.SampleRateK = 1
extractSubset1.IncludeBoundary = 0
doCoolStuff...
</snip>
So far, I’ve tried reading the VOI from the extractSubsetFilter, but the
indexing of the extent is not showing the grid dimensions:
dimensions = extractSubset1.GetPropertyValue('VOI')
print dimensions
But that returns an array [0, -1, 0, -1, 0, -1]. And I can’t seem to be able to
use relative indexes in the filter like: extractSubset1.VOI = [0, -1, -2, -1,
0, -1].
Any thoughts?
Cheers
Guillaume
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView
Search the list archives at: http://markmail.org/search/?q=ParaView
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview