[Insight-users] expand image function

robert tamburo robert.tamburo at gmail.com
Thu Mar 3 10:39:11 EST 2011


Sorry, that was unclear. Create a 12x12 image of zero-valued pixels, then
use PadImageFilter to paste your input image into the 12x12 image.

On Thu, Mar 3, 2011 at 10:37 AM, robert tamburo <robert.tamburo at gmail.com>wrote:

> You can use the PadImageFilter to create a 12x12 image of zero-valued
> pixels, then 'paste' your input image into it at a specified index (using
> SetDestinationIndex).
>
> http://www.itk.org/Doxygen36/html/classitk_1_1PasteImageFilter.html
>  <http://www.itk.org/Doxygen36/html/classitk_1_1PasteImageFilter.html>
>
> On Thu, Mar 3, 2011 at 10:27 AM, john smith <mkitkinsightuser at gmail.com>wrote:
>
>> 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);
>>
>>
>>         }
>>       }
>>
>>
>> }
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110303/f956317e/attachment.htm>


More information about the Insight-users mailing list