[Paraview] Volumes of Interest

pat marion pat.marion at kitware.com
Thu Feb 18 14:07:32 EST 2010


If you set a variable in the paraview python console before running a
script, the script will have access to that variable.  So you can pass
arguments to a python script by just setting sys.argv in the python console
before running the script.

Sean... I happen to have a patch that allows raw_input() to work from the
paraview gui.  Patch is attached.  When the script calls raw_input() it
causes a focused qt text entry box to appear at the cursor.  The entire
paraview gui is blocked until the user hits enter.  Not perfectly elegant,
but works pretty well.

The pvblot plugin I wrote makes extensive use of querying the user for input
from the gui.  I decided not to use raw_input() because it blocks the gui.
Instead I cooked up a fancy asynchronous input scheme using python
generators, decorators, and the yield statement.  It works really well, but
requires that you write your script using yield instead of raw_input().

Berk, I think we could add a method to the paraview.simple module that does
a callback to the gui for a file dialog, it would be similar to my attached
raw_input() patch.

Pat

On Thu, Feb 18, 2010 at 12:27 PM, Sean Ziegeler <
sean.ziegeler at nrlssc.navy.mil> wrote:

> Actually, that isn't a bad idea.  There doesn't seem to be a way of getting
> input to a Python script, as raw_input() doesn't appear to work in the
> Python Shell (in the PV GUI, at least) either.
>
>
> On 02/18/10 08:19, Berk Geveci wrote:
>
>> I didn't mention Python because it doesn't give you a way of popping up
>> a file chooser - you have to edit the script and change the file name.
>> Maybe we should add a Python command to pop up the file chooser... It is
>> not super easy but if there is enough demand, we can do it. Feel free to
>> add a feature request to the bug tracker or uservoice.
>>
>> -berk
>>
>> On Thu, Feb 18, 2010 at 8:06 AM, Jean M. Favre <jfavre at cscs.ch
>> <mailto:jfavre at cscs.ch>> wrote:
>>
>>    Natalie Happenhofer wrote:
>>     > Another topic - selecting volumes of interest: I can do that for
>>    one file, and it works well. But is it really necessary to repeat
>>    this procedure for every file I open in Paraview? Is it possible to
>>    select a volume of interest and for every file I open afterward,
>>    just this VoI is displayed?
>>     >
>>     >
>>    I would suggest doing this in Python in order to avoid reading the full
>>    resolution dataset by default. When opening a file, paraview forces you
>>    to click Apply before you can do anything else (such as creating an
>>    Extract Subset filter). Thus, the data reader uses
>>    UPDATE_EXTENT=WHOLE_EXTENT and you may run out of memory before being
>>    able to subset the grid.
>>
>>    if instead, you instantiate your reader, do not execute it, do not
>>    create a representation for it, then create an Extract Subset with the
>>    VOI you desire, and then execute the whole thing, you will end-up
>>    passing the VOI extents upstream directly to the reader, and your
>> reader
>>    will only execute once with the correct extents.
>>
>>    Use the python shell and the followin example:
>>
>>    reader = XMLImageDataReader( FileName= '/path/to/data/foo.vti'] )
>>    reader.PointArrayStatus = ['data1']
>>
>>    ExtractSubset1 = ExtractSubset()
>>
>>    ExtractSubset1.VOI = [2000, 2255, 2000, 2255, 2000, 2255]
>>
>>    DataRepresentation2 = Show(ExtractSubset1)
>>
>>    Render()
>>
>>    Jean--
>>    Swiss National Supercomputing Center
>>    _______________________________________________
>>    Powered by www.kitware.com <http://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
>>
>>    Follow this link to subscribe/unsubscribe:
>>    http://www.paraview.org/mailman/listinfo/paraview
>>
>>
>>
>>
>> _______________________________________________
>> 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
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.paraview.org/mailman/listinfo/paraview
>>
> _______________________________________________
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100218/051e92b7/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: paraview-stdin.diff
Type: text/x-diff
Size: 7700 bytes
Desc: not available
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100218/051e92b7/attachment.diff>


More information about the ParaView mailing list