Hi,<br><br>I am trying to modify a certain portion of an RGB image. I use an Iterator to which the desired region and the image are passed, but I am having trouble using the &#39;Set&#39; function to set the pixel values. Can anyone please help me pass the new pixel values using the &#39;Set&#39; command.
<br>The relevant portion of my code is as follows:<br><br>---------------<br>const unsigned int InputDimension =2;<br>typedef unsigned char InputPixelType;<br>typedef itk::Image&lt; InputPixelType, InputDimension &gt; InputImageType;
<br>typedef itk::ImageRegionIterator&lt; InputImageType &gt; IteratorType;<br><br>InputImageType::SizeType size;<br>InputImageType::IndexType start;<br>InputImageType::RegionType desiredregion;<br><br>//set the desired region
<br>size[0]=300;<br>size[1]=20;<br>start[0]=500;<br>start[1]=0;<br>desiredregion.SetIndex(start);<br>desiredregion.SetSize(size);<br><br>IteratorType out2( image, desiredregion ); //image is previously read<br>&nbsp;&nbsp;&nbsp; for(out2.GoToBegin
();!out2.IsAtEnd();++out2)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; out2.Set(0);//this is where I have problem<br>&nbsp;&nbsp;&nbsp; }<br><br>-----------<br><br>What should my &#39; out2.set() &#39; line look like to be able to set the color to black or any other value? Or is there any other simpler way to do this?
<br><br>Thanks in advance.<br>Ashish<br><br><br>