[Paraview] Scripting Paraview.

Andy Cedilnik andy.cedilnik at kitware.com
Fri Jul 21 09:59:22 EDT 2006


Mike,

set window [$Application GetMainWindow]

# This part reads the first file:
$window WriteVTKFile "/path/to/the/data/foo.vti" 0
set reader [$window InitializeReadCustom "XMLImageDataReader" 
"/path/to/the/data/foo1.vti"]
$window ReadFileInformation $reader "/path/to/the/data/foo1.vti"
$window FinalizeRead $reader "/path/to/the/data/foo1.vti"
set fileName [$reader GetPVWidget {Filename}]
$fileName SetValue "/path/to/the/data/foo1.vti"
$reader AcceptCallback

Or if you have the reader already:

# Populate the variables
set reader [$window GetCurrentPVSource]
set fileName [$reader GetPVWidget {Filename}]

Now you can change the file:

$fileName SetValue "/path/to/the/data/foo2.vti"
$reader AcceptCallback

and again

$fileName SetValue "/path/to/the/data/foo3.vti"
$reader AcceptCallback

Looks good?

Btw, be careful. This will only work if all your datasets are VTI. You 
cannot apply the same pipeline to different type datasets (images versus 
polydata).

       Andy

Mike Jackson wrote:
> No wait,
> we are missing my point. My point is that I have an existing Pipeline
> defined. I want to be able to apply that pipeline to any dataset that
> is loaded up in paraview. Right now I have .vti files of the data. I
> also have a program that will convert those .vti files into surface
> meshes (Actually, it takes data from an HDF5 file and creates the Mesh
> using VTK as the pipeline.) I started dumping VTI files during the
> process when I figured out Paraview could read them.
>
> If there was a way the tcl could get the "currently opened dataset",
> then the remainder is cake. But from what I am hearing from this list
> is that there isn't a way for the TCL scripting to get at the
> currently opened dataset. It must start from a data file on disk. Is
> that right?
>
> Mike Jackson
>
> On 7/20/06, Berk Geveci <berk.geveci at gmail.com> wrote:
>> This requires writing a state and then editing it. The state is a Tcl 
>> script
>> so it should be relatively easy to put a loop around it. Just  a 
>> warning,
>> creating 600 pipeline objects in a loop might not work well
>> performance-wise. I would recommend deleting the pipeline objects at 
>> the end
>> of each iteration.
>> Also, working with trace as opposed to state might be easier. Trace 
>> does not
>> save out as much info as state.
>>
>> -Berk
>>
>>
>> On 7/20/06, Mike Jackson < imikejackson at gmail.com> wrote:
>> > What I want to be able to do is load up one of these data sets and
>> > just apply the pipeline to it. The end result is a Triangle Surface
>> > mesh for 3D viewing and saving.
>> >
>> > I actually already have a program written with VTK that does just
>> > this. Except that the program is on one machine and Paraview is on
>> > another. I was hoping that if I could just have the pipeline ready in
>> > a script file, the scientists could bring me their .vti file, and then
>> > I can just apply the script and out pops my triangle mesh complete
>> > with proper coloring and all that.
>> >
>> > Also, Time animation is something that we would like to look at doing.
>> > I fiddled with some of it over the weekend but not ready to go much
>> > further with it right now.
>> >
>> > I was just hoping to be able to apply a script to an already loaded
>> dataset.
>> >
>> > Mike Jackson
>> >
>> > On 7/20/06, Andy Cedilnik <andy.cedilnik at kitware.com> wrote:
>> > > Hi Mike,
>> > >
>> > > You can write a script that will generate 600 states.
>> > >
>> > > What is really your end result? Do you want to animate? If so, just
>> > > click on timesteps and generate a time series out of your dataset.
>> > >
>> > >        Andy
>> > >
>> > > Mike Jackson wrote:
>> > > > Hello,
>> > > >    I have a pipeline that was developed (Thanks Andy) in 
>> paraview for
>> > > > a given data set. I now have about 600 of those datasets. I see 
>> that I
>> > > > can save a session state from paraview and reload it when I 
>> relaunch
>> > > > Paraview. But the session state seems to be really tied to the
>> > > > datafile on disk. What I really want is to be able to load one of
>> > > > those data sets, then load up a script that acts on that 
>> dataset, not
>> > > > the original dataset from the disk.
>> > > >   How would I best accomplish this.
>> > > >
>> > > > Thanks
>> > > >
>> > > > ------
>> > > > Mike Jackson
>> > > > Senior Research Engineer/New Visualization Engineer
>> > > > mike.jackson at imts.us
>> > > >
>> > > >
>> > > > _______________________________________________
>> > > > ParaView mailing list
>> > > > ParaView at paraview.org
>> > > > http://www.paraview.org/mailman/listinfo/paraview
>> > >
>> > >
>> > > --
>> > > Andy Cedilnik
>> > > Kitware Inc.
>> > >
>> > >
>> >
>> >
>> > --
>> > Mike Jackson
>> > imikejackson _at_ gee-mail dot com
>> > _______________________________________________
>> > ParaView mailing list
>> > ParaView at paraview.org
>> > http://www.paraview.org/mailman/listinfo/paraview
>> >
>>
>>
>
>


-- 
Andy Cedilnik
Kitware Inc.



More information about the ParaView mailing list