[Insight-users] Re: How to identify four corners of the image?
Luis Ibanez
luis.ibanez@kitware.com
Thu, 28 Nov 2002 23:56:51 -0500
Hi Valli,
Thanks for the additional details.
You can get the corners of a 2D image by doing:
ImageType::RegionType region = image->GetBufferedRegion();
ImageType::IndexType c1;
ImageType::IndexType c2;
ImageType::IndexType c3;
ImageType::IndexType c4;
ImageType::SizeType size = region.GetSize();
// index of the upper left corner
c1 = region.GetIdex();
// index of the lower right corner
c4[0] = c1[0] + size[0];
c4[1] = c1[1] + size[1];
// index of the upper right corner
c4[0] = c1[0] + size[0];
c4[1] = c1[1];
// index of the lower left corner
c4[0] = c1[0];
c4[1] = c1[1] + size[1];
Then you may probably want to use the FloodFilliterator
on each corner and add a connectivity condition to it.
Luis
====================================
cspl wrote:
> Hi Luis,
>
> Thankyou for your response.
>
> We are actually trying to implement an algorithm for Fillholes wherein steps
> include
>
> 3)Find corners of image, remember locations
>
> 4)Start from corners and identify all the pixels connected to any of the
> Four corners of the image.
>
> 5) Delete any pixels in the image NOT identified in step 4
> Raster through the image and set everything to zero _except_ pixels with the
> same labels as the corners.
>
> Regards,
> Valli
>