[vtkusers] Extract a slice and save it as jpg/png

Chris Turner cturnercomplex at googlemail.com
Fri Jul 9 17:02:28 EDT 2010


Hi Everyone!

I'm trying to extract a slice from a vtkImageData object and save it as picture.

That's how I do it:

voi=vtkExtractVOI()
voi.SetInput(imageData)
voi.SetVOI(0,0,0,512,512,1)
voi.Update()

writer=vtkJPEGWriter()
writer.SetInput(voi.GetOutput())
writer.SetFileName("slice.jpg")
writer.Write()

ImageData is 512x512x40 spacing 1,1,1

The strange thing is I don't get an output nor an error message. So I
think I'm missing something here.... but it can't figure out what.

So does anybody have an idea or a better solution?

Thanks
Chris



More information about the vtkusers mailing list