<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>