[Insight-users] expand image function

john smith mkitkinsightuser at gmail.com
Thu Mar 3 10:27:49 EST 2011


Hello,

I am trying to expand my image. I have created a function called *expandImage
*and I am trying to expand the input pointer *image *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.

Thanks in advance

------------------------------------------------------
-------------------------------------
void expandImage(ImageType::Pointer image)
{

  ImageType::IndexType start;
  start.Fill(0);

  ImageType::SizeType size;
  size.Fill(12);

  ImageType::RegionType region(start, size);
  image->SetRegions(region);
  image->Allocate();
  image->FillBuffer(0);


  // Make a square with value 0 on the even pixels and value 10 on the odd
pixels
    for(unsigned int i = 1; i < 11; i++)
      {
      for(unsigned int j = 1; j < 11; j++)
        {
        ImageType::IndexType pixelIndex;
        pixelIndex[0] = i;
        pixelIndex[1] = j;

      ///   image->SetPixel(pixelIndex, 255);


        }
      }


}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110303/74a05a0e/attachment.htm>


More information about the Insight-users mailing list