[Paraview] Extract the dimensions (or extent) of a structured grid within a python script
Utkarsh Ayachit
utkarsh.ayachit at kitware.com
Tue May 26 09:37:36 EDT 2015
Guillaume,
Use data information [1] as follows:
UpdatePIpeline(inputPvts)
extent = inputPvts.GetDataInformation().GetExtent()
See Section 3.3 from the ParView Guide[2] for more details.
Utkarsh
[1] http://www.paraview.org/ParaView3/Doc/Nightly/www/cxx-doc/classvtkPVDataInformation.html
[2] http://www.paraview.org/paraview-guide/
On Tue, May 26, 2015 at 8:07 AM, Guillaume Duclaux
<Guillaume.Duclaux at uib.no> wrote:
> 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
More information about the ParaView
mailing list