<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9px/normal Helvetica; "><span class="Apple-style-span" style="font-size: medium;">Hi Harish,&nbsp;</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9px/normal Helvetica; "><span class="Apple-style-span" style="font-size: medium;">you want something like:</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9px/normal Helvetica; "><span class="Apple-style-span" style="font-size: medium;"><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 9px/normal Helvetica; "><span class="Apple-style-span" style="font-size: medium; ">RGBImageType::PixelType pixelValue;&nbsp;</span></div><div>pixelValue[0] = 255;</div><div><div>pixelValue[1] = 0;</div><div><div>pixelValue[2] = 0;</div><div>it3.Set(pixelValue); &nbsp;</div><div><br></div><div>Regards,&nbsp;</div><div>C.Cagatay Bilgin</div></div></div><div><br class="Apple-interchange-newline"><blockquote type="cite"><br><br>Hi all,<br><br>I have created a RGBImage and copied a gray scale image to it. Now I would like to set some pixel values in RGBImage to some colors lets say red, green, etc. <br><br>My code is like this<br><br>&nbsp; /* For RGB Pixels */<br>
&nbsp; RGBImageType::Pointer rgbImage = RGBImageType::New();<br>&nbsp; rgbImage-&gt;SetRegions( image1-&gt;GetRequestedRegion() );<br>&nbsp; rgbImage-&gt;CopyInformation( image1 );<br>&nbsp; rgbImage-&gt;Allocate();<br>&nbsp; /* Iterate through the images */<br>
&nbsp; /* Here image1 and image2 are gray scale MRI images */<br>&nbsp; IteratorType it1( image1, image1-&gt;GetRequestedRegion());<br>&nbsp; IteratorType it2( image2, image2-&gt;GetRequestedRegion());<br>&nbsp; RGBIteratorType it3( rgbImage, rgbImage-&gt;GetRequestedRegion());<br>
<br>&nbsp; for ( it1.GoToBegin(), it2.GoToBegin(), it3.GoToBegin(); !it1.IsAtEnd() &amp;&amp; !it2.IsAtEnd();<br>&nbsp;&nbsp;&nbsp; ++it1, ++it2, ++it3)<br>&nbsp; {<br>&nbsp;&nbsp; /* Find x and y */<br>&nbsp;&nbsp; float x,y;<br>&nbsp;&nbsp; x = it1.Get();<br>&nbsp;&nbsp; y = it2.Get();<br>
&nbsp;&nbsp; int val = func(x,y);<br>&nbsp;&nbsp; if(val == 0)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; it3.Set(RED_COLOR);<br>&nbsp;&nbsp; else<br>&nbsp; &nbsp; &nbsp; it3.Set(GREEN_COLOR); <br>&nbsp; }<br><br><br>What should RED_COLOR and GREEN_COLOR be replaced with??<br><br>Thanks,<br>Harish<br>
_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.html<br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.itk.org/mailman/listinfo/insight-users<br></blockquote></div><br></body></html>