[Insight-developers] efficient way to avoid the outside pixel ?

Zachary Pincus zpincus at stanford.edu
Mon Nov 7 14:03:58 EST 2005


Well, for the simplest interpretation of Gaetan's question, just  
using the faces calculator directly will yield a region in which  
there are no boundary conditions. Just iterating over this region  
(I'm pretty sure it's the 0th region in the list returned by the  
calculator) might be enough for Gaetan's needs, depending on what  
they are.

More complex demands would need mucking with the faces calculator,  
but just finding out the biggest possible region where no  
neighborhood pixel falls outside the image can be done easily.

Zach



On Nov 7, 2005, at 5:28 AM, Miller, James V (Research) wrote:

> Gaetan,
>
> The NeighborhoodIterators support a version of GetPixel(const  
> unsigned i, bool& IsInBounds)
> that will tell you whether the pixel you requested is a boundary  
> condition pixel or an interior
> pixel.  So you can "elegantly" check after calling GetPixel() as to  
> whether it was a boundary
> condition pixel or not and avoid using it as necessary.
>
> While this may be "elegant" it may not be "efficient".  The method  
> still has to check whether
> the pixel in inbounds or not.  One could modify the face calculator  
> to divide an image into more
> regions, where each region would have exactly the same neighborhood  
> locations inbounds.  Currently,
> a 2D image is divided into as many as 5 (or maybe 9 regions, I may  
> have changed this a year or two
> ago to divide a 2D image into 9 regions).  Anyway, one region may  
> have no boundary conditions
> and the remainder have at least one boundary condition.  But as the  
> code stands currently, I am
> not sure that each pixel in each of the regions has exactly the  
> same boundary condition neighborhood
> locations.  But I could see it being possible to divide the regions  
> into more regions whereby every
> pixel in a given region has exactly the same neighborhood indices  
> inbounds. For instance, indices
> 2, 3, 5, 6, 8, 9 would be in bounds for all iterator positions  
> within the region that touches the
> left side of the image but not the top or bottom sides.
>
> Feasible, but not currently implemented this way.
>
> Jim
>
>
>
> -----Original Message-----
> From: insight-developers-bounces+millerjv=crd.ge.com at itk.org
> [mailto:insight-developers-bounces+millerjv=crd.ge.com at itk.org]On  
> Behalf
> Of Gaetan Lehmann
> Sent: Monday, November 07, 2005 5:29 AM
> To: insight-developers at itk.org
> Subject: [Insight-developers] efficient way to avoid the outside  
> pixel ?
>
>
>
> Hi,
>
> I already asked the question, but didn't get an answer.
> Is there an efficient (and elegant) way to avoid getting the pixels
> outside the image in a neighborhood iterator ? Most of the time, it is
> possible to use a constant boundary value, but it's not really  
> nice, and
> not really efficient.
>
> Thanks,
>
> Gaetan
>
> -- 
> Gaëtan Lehmann
> Biologie du Développement et de la Reproduction
> INRA de Jouy-en-Josas (France)
> tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
> http://voxel.jouy.inra.fr
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers



More information about the Insight-developers mailing list