[Paraview] reading a stack of TIFF images

Favre Jean jfavre at cscs.ch
Wed Nov 17 10:57:08 EST 2010


Hi there

this afternoon, I was asked to read a stack of TIFF images in ParaView. Well, I search the archive mailing list, tried different things which led me nowhere, and could not find a solution out of the box.

I then worked on a Python script which now works very well for our purpose. I thought I would post it since the question seems to come up every now and then, and I am not aware of a solution posted on the net. 

I used a ProgrammableSource, with output type set to "vtkImageData"

# I set my whole extend in the RequestInformation panel:

self.GetImageDataOutput().SetWholeExtent(0,511,0,511,0,192)

# and I filled in the Script text panel with:

import vtk
r = vtk.vtkTIFFReader()
r.SetFilePrefix("/local/data/red_Z")
r.SetFilePattern("%s%03d.tif")
r.SetDataExtent(0,511,0,511,0,192)
r.SetDataSpacing(1,1,0.001)
r.Update()
self.GetImageDataOutput().ShallowCopy(r.GetOutput())


Got a nice picture of a neuron after that, so I hope some other people find it useful.

-----------------
Jean M. Favre
Swiss National Supercomputing Center



More information about the ParaView mailing list