<div dir="ltr">Are you able to render this atleast, before trying to save?<br><br>Jothy<br><br><div class="gmail_quote">On Wed, Jul 14, 2010 at 4:27 PM, Chris Turner <span dir="ltr"><<a href="mailto:cturnercomplex@googlemail.com">cturnercomplex@googlemail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">bounds are (-69.3 ,323 ,332 ,9.68,468,448)<br>
extents are (0,0,0,79,145,116)<br>
<br>
I changed the SetVOI to (-69,323,332,-68,468,448) but same result.<br>
<div><div></div><div class="h5"><br>
<br>
On Wed, Jul 14, 2010 at 11:01 AM, Jothy <<a href="mailto:jothybasu@gmail.com">jothybasu@gmail.com</a>> wrote:<br>
> Have you checked that your setVOi is with the bounds of the Image. What are<br>
> your bounds?<br>
><br>
> Jothy<br>
><br>
> On Wed, Jul 14, 2010 at 3:58 PM, Chris Turner<br>
> <<a href="mailto:cturnercomplex@googlemail.com">cturnercomplex@googlemail.com</a>> wrote:<br>
>><br>
>> No didn't do the trick either.<br>
>><br>
>> No file, no error/warning message.<br>
>><br>
>> Thanks though!<br>
>><br>
>> On Wed, Jul 14, 2010 at 10:54 AM, Jothy <<a href="mailto:jothybasu@gmail.com">jothybasu@gmail.com</a>> wrote:<br>
>> > Try SetVOI(0,0,0,79,1,146)<br>
>> ><br>
>> > Jothy<br>
>> ><br>
>> > On Wed, Jul 14, 2010 at 3:44 PM, Chris Turner<br>
>> > <<a href="mailto:cturnercomplex@googlemail.com">cturnercomplex@googlemail.com</a>> wrote:<br>
>> >><br>
>> >> Hi David & Bill,<br>
>> >><br>
>> >> thanks for your patience and your help I appreciate it a lot! So this<br>
>> >> is the code with David's suggestion:<br>
>> >><br>
>> >> import os<br>
>> >> import vtk<br>
>> >> import sys<br>
>> >><br>
>> >><br>
>> >> reader=vtk.vtkImageReader()<br>
>> >> reader.SetFileName("/tmp/lungROI.vtk")<br>
>> >> reader.Update()<br>
>> >><br>
>> >> lut=vtk.vtkLookupTable()<br>
>> >> lut.SetRange(-1024, +4095)<br>
>> >><br>
>> >> map=vtk.vtkImageMapToColors()<br>
>> >> map.SetInput(reader.GetOutput())<br>
>> >> map.SetLookupTable(lut)<br>
>> >><br>
>> >><br>
>> >> voi=vtk.vtkExtractVOI()<br>
>> >> voi.SetInput(map.GetOutput())<br>
>> >> voi.SetVOI(0,0,0,79,146,1)<br>
>> >> voi.Update()<br>
>> >><br>
>> >> writerp=vtk.vtkPNGWriter()<br>
>> >> writerp.SetInput(voi.GetOutput())<br>
>> >> writerp.SetFileName("/tmp/out.png")<br>
>> >> writerp.Write()<br>
>> >><br>
>> >> print "done"<br>
>> >><br>
>> >><br>
>> >> .... but still no output nor an error message. You can take a look at<br>
>> >> the Image here:<br>
>> >><br>
>> >> <a href="http://www.load.to/t8MWurwasf/lungROI.vtk" target="_blank">http://www.load.to/t8MWurwasf/lungROI.vtk</a> (~10mb)<br>
>> >><br>
>> >> Thanks Again,<br>
>> >> Chris<br>
>> >><br>
>> >><br>
>> >> On Tue, Jul 13, 2010 at 4:38 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br>
>> >> wrote:<br>
>> >> > Hi Chris,<br>
>> >> ><br>
>> >> > This could be an instance of trying to write 16-bit data to a JPEG<br>
>> >> > file. Try adding vtkImageMapToColors with a suitable vtkLookupTable.<br>
>> >> > The Range of the lookup table will have to be set to something<br>
>> >> > reasonable for the image, a range of (-1024, +4095) is a good place<br>
>> >> > to<br>
>> >> > start and then you can increase or decrease the range in order to get<br>
>> >> > the contrast right.<br>
>> >> ><br>
>> >> > David<br>
>> >> ><br>
>> >> ><br>
>> >> > On Tue, Jul 13, 2010 at 2:15 PM, Bill Lorensen<br>
>> >> > <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>><br>
>> >> > wrote:<br>
>> >> >> Post you entire example. And, if you can post a link to your data...<br>
>> >> >><br>
>> >> >> On Tue, Jul 13, 2010 at 3:57 PM, Chris Turner<br>
>> >> >> <<a href="mailto:cturnercomplex@googlemail.com">cturnercomplex@googlemail.com</a>> wrote:<br>
>> >> >>> Hi Bill,<br>
>> >> >>><br>
>> >> >>> thanks for your answer! But didn't do the trick.<br>
>> >> >>> So strange I thought this was a standard question and procedure.<br>
>> >> >>> And<br>
>> >> >>> that there has to be a easy way to do that.<br>
>> >> >>><br>
>> >> >>> And why don't I even get a error message or something. Even when I<br>
>> >> >>> turn on the debug mode there is nothing suspicious.<br>
>> >> >>><br>
>> >> >>> Anybody has another approach?<br>
>> >> >>><br>
>> >> >>> Thanks<br>
>> >> >>> Chris<br>
>> >> >>><br>
>> >> >>> On Mon, Jul 12, 2010 at 10:16 AM, Bill Lorensen<br>
>> >> >>> <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>> wrote:<br>
>> >> >>>> Try,<br>
>> >> >>>> voi.SetVOI(0,0,0,511,511,0)<br>
>> >> >>>><br>
>> >> >>>> On Mon, Jul 12, 2010 at 10:07 AM, Chris Turner<br>
>> >> >>>> <<a href="mailto:cturnercomplex@googlemail.com">cturnercomplex@googlemail.com</a>> wrote:<br>
>> >> >>>>> Really? Am I the only one with that problem?<br>
>> >> >>>>><br>
>> >> >>>>> On Fri, Jul 9, 2010 at 5:02 PM, Chris Turner<br>
>> >> >>>>> <<a href="mailto:cturnercomplex@googlemail.com">cturnercomplex@googlemail.com</a>> wrote:<br>
>> >> >>>>>> Hi Everyone!<br>
>> >> >>>>>><br>
>> >> >>>>>> I'm trying to extract a slice from a vtkImageData object and<br>
>> >> >>>>>> save<br>
>> >> >>>>>> it as picture.<br>
>> >> >>>>>><br>
>> >> >>>>>> That's how I do it:<br>
>> >> >>>>>><br>
>> >> >>>>>> voi=vtkExtractVOI()<br>
>> >> >>>>>> voi.SetInput(imageData)<br>
>> >> >>>>>> voi.SetVOI(0,0,0,512,512,1)<br>
>> >> >>>>>> voi.Update()<br>
>> >> >>>>>><br>
>> >> >>>>>> writer=vtkJPEGWriter()<br>
>> >> >>>>>> writer.SetInput(voi.GetOutput())<br>
>> >> >>>>>> writer.SetFileName("slice.jpg")<br>
>> >> >>>>>> writer.Write()<br>
>> >> >>>>>><br>
>> >> >>>>>> ImageData is 512x512x40 spacing 1,1,1<br>
>> >> >>>>>><br>
>> >> >>>>>> The strange thing is I don't get an output nor an error message.<br>
>> >> >>>>>> So<br>
>> >> >>>>>> I<br>
>> >> >>>>>> think I'm missing something here.... but it can't figure out<br>
>> >> >>>>>> what.<br>
>> >> >>>>>><br>
>> >> >>>>>> So does anybody have an idea or a better solution?<br>
>> >> >>>>>><br>
>> >> >>>>>> Thanks<br>
>> >> >>>>>> Chris<br>
>> >> >>>>>><br>
>> >> >>>>> _______________________________________________<br>
>> >> >>>>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>> >> >>>>><br>
>> >> >>>>> Visit other Kitware open-source projects at<br>
>> >> >>>>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>> >> >>>>><br>
>> >> >>>>> Please keep messages on-topic and check the VTK FAQ at:<br>
>> >> >>>>> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>> >> >>>>><br>
>> >> >>>>> Follow this link to subscribe/unsubscribe:<br>
>> >> >>>>> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
>> >> >>>>><br>
>> >> >>>><br>
>> >> >>><br>
>> >> >> _______________________________________________<br>
>> >> >> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>> >> >><br>
>> >> >> Visit other Kitware open-source projects at<br>
>> >> >> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>> >> >><br>
>> >> >> Please keep messages on-topic and check the VTK FAQ at:<br>
>> >> >> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>> >> >><br>
>> >> >> Follow this link to subscribe/unsubscribe:<br>
>> >> >> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
>> >> >><br>
>> >> ><br>
>> >> _______________________________________________<br>
>> >> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>> >><br>
>> >> Visit other Kitware open-source projects at<br>
>> >> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>> >><br>
>> >> Please keep messages on-topic and check the VTK FAQ at:<br>
>> >> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>> >><br>
>> >> Follow this link to subscribe/unsubscribe:<br>
>> >> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
>> ><br>
>> ><br>
>> _______________________________________________<br>
>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>><br>
>> Visit other Kitware open-source projects at<br>
>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>><br>
>> Please keep messages on-topic and check the VTK FAQ at:<br>
>> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div><br></div>