You can use the PadImageFilter to create a 12x12 image of zero-valued pixels, then &#39;paste&#39; your input image into it at a specified index (using SetDestinationIndex).<div><br></div><div><a href="http://www.itk.org/Doxygen36/html/classitk_1_1PasteImageFilter.html">http://www.itk.org/Doxygen36/html/classitk_1_1PasteImageFilter.html</a></div>
<div><a href="http://www.itk.org/Doxygen36/html/classitk_1_1PasteImageFilter.html"></a><br><br><div class="gmail_quote">On Thu, Mar 3, 2011 at 10:27 AM, john smith <span dir="ltr">&lt;<a href="mailto:mkitkinsightuser@gmail.com">mkitkinsightuser@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">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&#39;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-&gt;SetRegions(region);<br>  image-&gt;Allocate();<br>  image-&gt;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 &lt; 11; i++)<br>      {<br>      for(unsigned int j = 1; j &lt; 11; j++)<br>        {<br>        ImageType::IndexType pixelIndex;<br>        pixelIndex[0] = i;<br>        pixelIndex[1] = j;<br>

                <br>      ///   image-&gt;SetPixel(pixelIndex, 255);          <br><br><br>        }<br>      }<br><br><br>}<br>
<br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br></div>