[vtkusers] reading 3D tif images
Suzanne Little
Suzanne.Little at ibai-institut.de
Wed Oct 10 10:21:26 EDT 2007
Dear all,
I'm trying to read in a tiff stack -- single tiff image with a sequence
of 2D slices. I think I should set the file dimensionality to 3 for the
reader but that isn't working.
Is it possible to read 3D tiff files into VTK?
Below is python code I've been using for testing. I've run it using VTK
5.0 in Enthought's Python 2.4.3 distribution. I've also written
equivalent C++ code and run that using VTK 5.0.3 compiled in Borland C++
(BDS2006). The render window shows a bar (120*1.6) based on the circle
in the first image in the stack.
I've successfully rendered the model by splitting the tiff manually into
seperate 2D files (tiffsplit) and using SetFileName and SetFilePattern.
#some python code for testing
import vtk
#setup renderer
# --cut--
#read in the tiff stack
reader = vtk.vtkTIFFReader()
reader.SetFileDimensionality(3)
reader.SetFileName("C:\vtk\mydata\stack.tif")
reader.SetDataExtent(0,499,0,499,0,120)
reader.SetDataSpacing(1.0,1.0,1.6)
#ContourFilter -> PolyDataNormals -> PolyDataMapper -> Actor
# --cut--
#camera, add actor, render
# --cut--
Regards,
Suzanne
More information about the vtkusers
mailing list