[Insight-users] Finding out when a neighborhood iterator is outside the image?

Joshua Cates cates at sci.utah.edu
Thu Jul 29 16:02:22 EDT 2004


Hi Zach,

There is a method common to all NeighborhoodIterators called InBounds()  
that returns false when the neighborhood overlaps the boundary.  This
method is relatively slow, however, so I don't recommend using it unless
you are doing sparse access into the image.  If you are just sampling
points here and there in the image, then this method shouldn't add too
much overhead.


Josh.


On Thu, 29 Jul 2004, Zachary Pincus wrote:

> Hello,
> 
> I seem to recall seeing somewhere a method in ITK for determining when 
> a particular element of a neighborhood (or shaped neighborhood) is 
> outside of the real image. Unfortunately, neither searching the list 
> nor wracking my brain can retrieve this information.
> 
> Basically, I'm using shaped neighborhoods to get pairs of pixels to do 
> statistics on. Previously, I had just used the BoundaryFacesCalculator 
> to get the region of an image where a given neighborhood could not 
> possibly be outside the image. The problem is that just using that 
> region is too conservative: there are parts of the image where a given 
> neighborhood center and offset are still both on the image, even though 
> other parts of the neighborhood might be dangling off.
> 
> Maybe the best thing here would be to create a 
> "ThrowExceptionBoundaryCondition" and then catch the exception when 
> necessary to determine whether a given pixel is actually outside of the 
> image. Would that work, or are there other better ideas?
> 
> 
> Zach Pincus
> 
> Department of Biochemistry and Program in Biomedical Informatics
> Stanford University School of Medicine
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 



More information about the Insight-users mailing list