hi David,<br><br>Thanks for the quick reply.&nbsp; I&#39;ve put the following 3 lines into my code:<br><br><br>&nbsp; viewer-&gt;GetWindowLevel()-&gt;SetWindow( 255.0 );<br>&nbsp; viewer-&gt;GetWindowLevel()-&gt;SetLevel( 127.5 );<br>&nbsp; viewer-&gt;GetWindowLevel()-&gt;SetLookupTable( 0 );<br>

<br>(your 1st email was sent to me only, not to vtkusers), but I still only get black/white image.&nbsp; Actually, the line that nulls the lookup table doesn&#39;t change the grabbed image at all.&nbsp; Should I not use vtkImageViewer2 at all?<br>
<br>h.imageRGB is an int array created using &quot;new int [ 720x480x3 ]&quot;.&nbsp; What data scalar type should I set it to?<br><br>Elvis<br><br><br><div class="gmail_quote">On Wed, Mar 5, 2008 at 3:07 PM, David Gobbi &lt;<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>&gt; wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">And you might also have to set the following:<br>
<br>
viewer-&gt;GetWindowLevel()-&gt;SetWindow(255.0);<br>
viewer-&gt;GetWindowLevel()-&gt;SetLevel(127.5);<br>
<font color="#888888"><br>
 &nbsp; David<br>
</font><div><div></div><div><br>
<br>
<br>
On Wed, Mar 5, 2008 at 3:04 PM, David Gobbi &lt;<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>&gt; wrote:<br>
&gt; Hi Elvis,<br>
&gt;<br>
&gt; &nbsp;I looked at the vtkImageViewer2 code, and it creates a default color<br>
&gt; &nbsp;table for you. &nbsp;If you get rid of its color table, it should display the RGB<br>
&gt; &nbsp;data directly.<br>
&gt;<br>
&gt; &nbsp;The command to get rid of the viewer&#39;s color table is as follows:<br>
&gt;<br>
&gt; &nbsp;viewer-&gt;GetWindowLevel()-&gt;SetLookupTable(0);<br>
&gt;<br>
&gt; &nbsp; &nbsp;David<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; &nbsp;On Wed, Mar 5, 2008 at 2:48 PM, Elvis Chen &lt;<a href="mailto:elvis.chen@gmail.com" target="_blank">elvis.chen@gmail.com</a>&gt; wrote:<br>
&gt; &nbsp;&gt; hello,<br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt; I&#39;m trying to import video/still-images from an ultra-sound machine and<br>
&gt; &nbsp;&gt; display it using vtk. &nbsp;I can grab an image from the frame-grabber and save<br>
&gt; &nbsp;&gt; the image as PPM (basically RGB values with some headers). &nbsp;The range of the<br>
&gt; &nbsp;&gt; RGB is [0..255] and I know the dimension of the image.<br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt; Instead of saving it to a file I want vtk to grab the array pointer and<br>
&gt; &nbsp;&gt; display it directly. &nbsp;My code looks like:<br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt; &nbsp; vtkImageImport *importer = vtkImageImport::New();<br>
&gt; &nbsp;&gt; &nbsp; importer-&gt;SetWholeExtent( 0, 719, 0, 479, 0, 0 );<br>
&gt; &nbsp;&gt; &nbsp; &nbsp;importer-&gt;SetDataExtentToWholeExtent();<br>
&gt; &nbsp;&gt; &nbsp; importer-&gt;SetDataScalarTypeToInt();<br>
&gt; &nbsp;&gt; &nbsp; importer-&gt;SetNumberOfScalarComponents( 3 );<br>
&gt; &nbsp;&gt; &nbsp; importer-&gt;SetImportVoidPointer( h.imageRGB );<br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt; &nbsp; vtkImageFlip *flip = vtkImageFlip::New();<br>
&gt; &nbsp;&gt; &nbsp; &nbsp;flip-&gt;SetInputConnection( importer-&gt;GetOutputPort() );<br>
&gt; &nbsp;&gt; &nbsp; flip-&gt;SetFilteredAxis( 1 );<br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt; &nbsp; vtkImageViewer2 *viewer = vtkImageViewer2::New();<br>
&gt; &nbsp;&gt; &nbsp; viewer-&gt;SetInputConnection( flip-&gt;GetOutputPort() );<br>
&gt; &nbsp;&gt; &nbsp; &nbsp;viewer-&gt;SetZSlice( 0 );<br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt; where h.imageRGB is a pointer to integer array whose size is 720x480x3. &nbsp;The<br>
&gt; &nbsp;&gt; RGB are stored as [R0 G0 B0 R1 G1 B2 ... ] in h.imageRGB. &nbsp;The first pixel<br>
&gt; &nbsp;&gt; is on the top-left corner so I need to use vtkImageFlip to get the correct<br>
&gt; &nbsp;&gt; orientation.<br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt; The resulting image displayed fine except for the colour. &nbsp;It looks like a<br>
&gt; &nbsp;&gt; gray-scale image where as the original US image has come coloured region.<br>
&gt; &nbsp;&gt; Can someone please shed some light into what might be wrong? &nbsp;Is there a<br>
&gt; &nbsp;&gt; function to get the range of pixel value (to 0 to 255)?<br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt; Any help is very much appreciated,<br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt; Elvis<br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt; _______________________________________________<br>
&gt; &nbsp;&gt; &nbsp;This is the private VTK discussion list.<br>
&gt; &nbsp;&gt; &nbsp;Please keep messages on-topic. Check the FAQ at:<br>
&gt; &nbsp;&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt; &nbsp;&gt; &nbsp;Follow this link to subscribe/unsubscribe:<br>
&gt; &nbsp;&gt; &nbsp;<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt; &nbsp;&gt;<br>
&gt; &nbsp;&gt;<br>
&gt;<br>
</div></div></blockquote></div><br>