<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, </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; </span></div><div>pixelValue[0] = 255;</div><div><div>pixelValue[1] = 0;</div><div><div>pixelValue[2] = 0;</div><div>it3.Set(pixelValue); </div><div><br></div><div>Regards, </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> /* For RGB Pixels */<br>
RGBImageType::Pointer rgbImage = RGBImageType::New();<br> rgbImage->SetRegions( image1->GetRequestedRegion() );<br> rgbImage->CopyInformation( image1 );<br> rgbImage->Allocate();<br> /* Iterate through the images */<br>
/* Here image1 and image2 are gray scale MRI images */<br> IteratorType it1( image1, image1->GetRequestedRegion());<br> IteratorType it2( image2, image2->GetRequestedRegion());<br> RGBIteratorType it3( rgbImage, rgbImage->GetRequestedRegion());<br>
<br> for ( it1.GoToBegin(), it2.GoToBegin(), it3.GoToBegin(); !it1.IsAtEnd() && !it2.IsAtEnd();<br> ++it1, ++it2, ++it3)<br> {<br> /* Find x and y */<br> float x,y;<br> x = it1.Get();<br> y = it2.Get();<br>
int val = func(x,y);<br> if(val == 0)<br> it3.Set(RED_COLOR);<br> else<br> it3.Set(GREEN_COLOR); <br> }<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>