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

Bill Lorensen bill.lorensen at gmail.com
Mon Jul 12 10:16:31 EDT 2010


Try,
voi.SetVOI(0,0,0,511,511,0)

On Mon, Jul 12, 2010 at 10:07 AM, Chris Turner
<cturnercomplex at googlemail.com> wrote:
> Really? Am I the only one with that problem?
>
> On Fri, Jul 9, 2010 at 5:02 PM, Chris Turner
> <cturnercomplex at googlemail.com> wrote:
>> 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
>>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list