[vtkusers] beginner question - how to display different images sequentially?

Paul Cochrane cochrane at esscc.uq.edu.au
Thu Mar 31 20:06:11 EST 2005


Akiko,

I'm a bit of vtk newbie, but hopefully I can be of some help

I'd try doing something like in the following code (python; untested, so may
not work; should map fairly easily to your favourite language)

import vtk

for i in range(11):
    # generate the filename to load
    fname = "%d.vtk" % i
    
    # set up the reader
    reader = vtk.vtkPolyDataReader()
    reader.SetFileName(fname)
    reader.Update()

    # read the data
    polydata = reader.GetOutput()
    
    # map the data to something that can be viewed
    mapper = vtk.vtkPolyDataMapper()
    mapper.SetInput(polydata)

    # set up the actor for the data mapper
    actor = vtk.vtkActor()
    actor.SetMapper(mapper)

    # set up the renderer
    ren = vtk.vtkRenderer()
    renWin = vtk.vtkRenderWindow()
    renWin.AddRenderer(ren)

    # add the actor to the renderer
    ren.AddActor(actor)

    # render!
    renWin.Render()


That would be the code I would write initially.  Hope it is of some help to
you.

Paul
    
-- 
Paul Cochrane
Computational Scientist/Software Developer
Earth Systems Science Computational Centre
Rm 703, SMI Building
University of Queensland
Brisbane
Queensland 4072
Australia

E: cochrane at esscc.uq.edu.au
P: +61 7 3346 4109
F: +61 7 3365 7347



More information about the vtkusers mailing list