I think the RGB pixel data is usually allocated like:<br><br>&nbsp;&nbsp;&nbsp; RGBRGBRGB etc....<br><br>so you have numPixels * 3 actual elements in your image data array.<br><br>You get a pixel pointer as usual and cast it to (unsigned char*):<br>
<br>// Get a pointer to the actual pixel data. <br>unsigned char *pVtkPix = (unsigned char *)pImgData-&gt;GetScalarPointer();<br><br>// These are the r,g and b values for the first pixel:<br>int rr&nbsp; = pVtkPix[0];<br>int gg = pVtkPix[1];<br>
int bb = pVtkPix[2];<br><br>// For the second pixel:<br>rr&nbsp; = pVtkPix[3];<br>gg = pVtkPix[4];<br>bb = pVtkPix[5];<br><br>and so on. Make sure you don&#39;t have RGBA data, if you do, then you just have an extra index per pixel which is the alpha component. Let me know if that helps,<br>
<br>Mark<br><br><br><div class="gmail_quote">On Wed, Apr 23, 2008 at 7:08 PM,  &lt;<a href="mailto:yenanqu@scs.fsu.edu">yenanqu@scs.fsu.edu</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;">
Hi, Mark, I did have the data that is three component. Your example only shows how to get pixel data that is one component which I never got in my code before. Do you have any idea how to retrieve this three component data?<br>

I have try bunch of methods, but none of them is working. any help will be greatly appreciated.<div class="Ih2E3d"><br>
<br>
Yenan<br>
<br>
Quoting Mark Wyszomierski &lt;<a href="mailto:markww@gmail.com" target="_blank">markww@gmail.com</a>&gt;:<br>
<br>
</div><div><div></div><div class="Wj3C7c"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br>
<br>
It&#39;s definitely possible to get the scalar value from a vtkImageData<br>
object. You need to know the type of data your object is stored in<br>
though, for example you&#39;ll have difficulty getting the scalar value if<br>
your data is three component RGB and you&#39;re trying to get a single<br>
pixel scalar pixel value.<br>
<br>
I have an example of getting the pixel value that the mouse moves over<br>
in an image here:<br>
<br>
 &nbsp;<a href="http://devsample.org/index.php?option=com_content&amp;task=view&amp;id=48&amp;Itemid=27" target="_blank">http://devsample.org/index.php?option=com_content&amp;task=view&amp;id=48&amp;Itemid=27</a><br>
<br>
which may help.<br>
<br>
Mark<br>
<br>
<br>
On Thu, Mar 27, 2008 at 1:37 PM, &nbsp;&lt;<a href="mailto:yenanqu@scs.fsu.edu" target="_blank">yenanqu@scs.fsu.edu</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi, all,<br>
I found bunch of the VTK methods to retrieve pixel data from vtk<br>
object, such as<br>
GetPixelData, GetRGBACharPixelData, etc, but none of them is working,<br>
Does anyone know how to get pixel data from VTK object? Thanks in<br>
advance.<br>
<br>
Yenan<br>
<br>
----------------------------------------------------------------<br>
This message was sent using IMP, the Internet Messaging Program.<br>
<br>
<br>
--<br>
This message has been scanned for viruses and<br>
dangerous content by MailScanner, and is<br>
believed to be clean.<br>
<br>
_______________________________________________<br>
This is the private VTK discussion list.<br>
Please keep messages on-topic. Check the FAQ at: &nbsp;<a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><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>
</blockquote>
<br>
--<br>
This message has been scanned for viruses and<br>
dangerous content by MailScanner, and is<br>
believed to be clean.<br>
<br>
<br>
</blockquote>
<br>
<br>
<br>
----------------------------------------------------------------<br>
This message was sent using IMP, the Internet Messaging Program.<br>
<br>
<br>
-- <br>
This message has been scanned for viruses and<br>
dangerous content by MailScanner, and is<br>
believed to be clean.<br>
<br>
</div></div></blockquote></div><br>