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 'Set' function to set the pixel values. Can anyone please help me pass the new pixel values using the 'Set' 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< InputPixelType, InputDimension > InputImageType;
<br>typedef itk::ImageRegionIterator< InputImageType > 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> for(out2.GoToBegin
();!out2.IsAtEnd();++out2)<br> {<br> out2.Set(0);//this is where I have problem<br> }<br><br>-----------<br><br>What should my ' out2.set() ' 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>