[vtkusers] Streamed input/output

Milos Sramek sramek.milos at gmail.com
Mon Sep 29 08:13:09 EDT 2008


Hi,

Does streaming in VTK work for input and output? I ask, because I've 
recently got an impression that not. I may, however,  do something wrong.

This is my code:

reader = vtkImageGaussianSource()
reader.SetWholeExtent(0,511,0,511,0,511) #1GB volume, 8bytes/voxel

mag1 = vtkImageMagnify()
mag1.SetInput(reader.GetOutput())
mag1.SetMagnificationFactors(2, 2, 2) # 8GB here

mag2 = vtkImageShrink3D()
mag2.SetInput(mag1.GetOutput())
mag2.SetShrinkFactors(4,4,4) # 128MB here

streamer = vtkMemoryLimitImageDataStreamer()
streamer.SetInput(mag2.GetOutput())
streamer.SetMemoryLimit(1000)

mhdwriter = vtkMetaImageWriter()
mhdwriter.SetFileName("mhdWriter.mhd")
mhdwriter.SetInput(streamer.GetOutput())
mhdwriter.Write()

The actual allocated memory depends on the mag2.SetShrinkFactors(.) call,
which specifies size of the output volume. If set to (4,4,4), the 
allocated memory is of about 150MB, if set to (2,2,2), it is
of about 1.1GB. If set to (1,1,1) (no shrinking), the program crashes, 
similarly as in the case when I skip the streamer and ask for output 
from mag2 directly (my memory is just 2GB).
 Streaming obviously works well, but not for the vtkMetaImageWriter().

If vtkImageGaussianSource() is replaced by vtkImageReader2, the program 
crashes for big data.
I use vtk5 on 32 bit linux (ubuntu).

Do I do something wrong?

Thank you for help in advance
Milos

-- 
email & jabber: sramek.milos at gmail.com




More information about the vtkusers mailing list