Hello, <br><br>I am trying to expand my image. I have created a function called <i>expandImage </i>and I am trying to expand the input pointer <i>image </i>from 10x10 to 12x12, with boundary pixels having value 0. All the other's no-boundary pixels I want them to get the values from the input image respectively. But I do not know how to do it. Has anybody any idea? Here is my function.<br>
<br>Thanks in advance<br><br>------------------------------------------------------<br>-------------------------------------<br>void expandImage(ImageType::Pointer image)<br>{<br> <br> ImageType::IndexType start;<br> start.Fill(0);<br>
<br> ImageType::SizeType size;<br> size.Fill(12);<br> <br> ImageType::RegionType region(start, size);<br> image->SetRegions(region);<br> image->Allocate();<br> image->FillBuffer(0);<br> <br> <br> // Make a square with value 0 on the even pixels and value 10 on the odd pixels<br>
for(unsigned int i = 1; i < 11; i++)<br> {<br> for(unsigned int j = 1; j < 11; j++)<br> {<br> ImageType::IndexType pixelIndex;<br> pixelIndex[0] = i;<br> pixelIndex[1] = j;<br>
<br> /// image->SetPixel(pixelIndex, 255); <br><br><br> }<br> }<br><br><br>}<br>