<div dir="ltr">Try SetVOI(0,0,0,79,<b><span style="color: rgb(255, 0, 0);">1,146</span></b>)<br><br>Jothy<br><br><div class="gmail_quote">On Wed, Jul 14, 2010 at 3:44 PM, Chris Turner <span dir="ltr">&lt;<a href="mailto:cturnercomplex@googlemail.com">cturnercomplex@googlemail.com</a>&gt;</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;">Hi David &amp; Bill,<br>
<br>
thanks for your patience and your help I appreciate it a lot!  So this<br>
is the code with David&#39;s suggestion:<br>
<br>
import os<br>
import vtk<br>
import sys<br>
<br>
<br>
reader=vtk.vtkImageReader()<br>
reader.SetFileName(&quot;/tmp/lungROI.vtk&quot;)<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(&quot;/tmp/out.png&quot;)<br>
writerp.Write()<br>
<br>
print &quot;done&quot;<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 &lt;<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>&gt; wrote:<br>
&gt; Hi Chris,<br>
&gt;<br>
&gt; This could be an instance of trying to write 16-bit data to a JPEG<br>
&gt; file.  Try adding vtkImageMapToColors with a suitable vtkLookupTable.<br>
&gt;  The Range of the lookup table will have to be set to something<br>
&gt; reasonable for the image, a range of (-1024, +4095) is a good place to<br>
&gt; start and then you can increase or decrease the range in order to get<br>
&gt; the contrast right.<br>
&gt;<br>
&gt;   David<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Jul 13, 2010 at 2:15 PM, Bill Lorensen &lt;<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt; wrote:<br>
&gt;&gt; Post you entire example. And, if you can post a link to your data...<br>
&gt;&gt;<br>
&gt;&gt; On Tue, Jul 13, 2010 at 3:57 PM, Chris Turner<br>
&gt;&gt; &lt;<a href="mailto:cturnercomplex@googlemail.com">cturnercomplex@googlemail.com</a>&gt; wrote:<br>
&gt;&gt;&gt; Hi Bill,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; thanks for your answer! But didn&#39;t do the trick.<br>
&gt;&gt;&gt; So strange I thought this was a standard question and procedure. And<br>
&gt;&gt;&gt; that there has to be a easy way to do that.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; And why don&#39;t I even get a error message or something. Even when I<br>
&gt;&gt;&gt; turn on the debug mode there is nothing suspicious.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Anybody has another approach?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Thanks<br>
&gt;&gt;&gt; Chris<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Mon, Jul 12, 2010 at 10:16 AM, Bill Lorensen &lt;<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt; Try,<br>
&gt;&gt;&gt;&gt; voi.SetVOI(0,0,0,511,511,0)<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; On Mon, Jul 12, 2010 at 10:07 AM, Chris Turner<br>
&gt;&gt;&gt;&gt; &lt;<a href="mailto:cturnercomplex@googlemail.com">cturnercomplex@googlemail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt;&gt; Really? Am I the only one with that problem?<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; On Fri, Jul 9, 2010 at 5:02 PM, Chris Turner<br>
&gt;&gt;&gt;&gt;&gt; &lt;<a href="mailto:cturnercomplex@googlemail.com">cturnercomplex@googlemail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt;&gt;&gt; Hi Everyone!<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; I&#39;m trying to extract a slice from a vtkImageData object and save it as picture.<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; That&#39;s how I do it:<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; voi=vtkExtractVOI()<br>
&gt;&gt;&gt;&gt;&gt;&gt; voi.SetInput(imageData)<br>
&gt;&gt;&gt;&gt;&gt;&gt; voi.SetVOI(0,0,0,512,512,1)<br>
&gt;&gt;&gt;&gt;&gt;&gt; voi.Update()<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; writer=vtkJPEGWriter()<br>
&gt;&gt;&gt;&gt;&gt;&gt; writer.SetInput(voi.GetOutput())<br>
&gt;&gt;&gt;&gt;&gt;&gt; writer.SetFileName(&quot;slice.jpg&quot;)<br>
&gt;&gt;&gt;&gt;&gt;&gt; writer.Write()<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; ImageData is 512x512x40 spacing 1,1,1<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; The strange thing is I don&#39;t get an output nor an error message. So I<br>
&gt;&gt;&gt;&gt;&gt;&gt; think I&#39;m missing something here.... but it can&#39;t figure out what.<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; So does anybody have an idea or a better solution?<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Thanks<br>
&gt;&gt;&gt;&gt;&gt;&gt; Chris<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt;&gt;&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; 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>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; 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>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt;&gt;&gt;&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt;<br>
&gt;&gt; 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>
&gt;&gt;<br>
&gt;&gt; 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>
&gt;&gt;<br>
&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;&gt;<br>
&gt;<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>
</blockquote></div><br></div>