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

Joshua Cates cates at sci.utah.edu
Fri Jul 30 11:47:06 EDT 2004


This sounds like a good idea, especially since there is already 
a corresponding SetPixel method.

Josh.

On Fri, 30 Jul 2004, Miller, James V (Research) wrote:

> Here is my current thoughts.
> 
> NeighborhoodIterator has a method 
> 
> SetPixel(const unsigned i, const PixelType &v, bool& status) 
> 
> where the "status" is set to true if the pixel was set and false
> if the location i is outside the image.
> 
> So am I adding a version of 
> 
> GetPixel(const unsigned i, bool& IsInBounds)
> 
> to ConstNeighborhoodIterator which sets the boolean IsInBounds
> as to whether the pixel value returned is an actual pixel or a 
> boundary condition value.
> 
> How does that sound?
> 
> Jim
> 
> 
> 
> -----Original Message-----
> From: Joshua Cates [mailto:cates at sci.utah.edu]
> Sent: Friday, July 30, 2004 10:49 AM
> To: Miller, James V (Research)
> Cc: Zachary Pincus; insight-users List
> Subject: RE: [Insight-users] Finding out when a neighborhood iterator is
> o utside the image?
> 
> 
> One possibility is to use the NeighborhoodIterator::GetIndex(offset)  
> method to return the image index of the offset and then query the
> Image::RequestedRegion::IsInside(index) method to determine if that index
> is within the bounds of the image.
> 
> Josh.
> 
> 
> On Fri, 30 Jul 2004, Miller, James V (Research) wrote:
> 
> > Josh, 
> > 
> > I think Zach is interested in knowing when an offest within a
> > Neighborhood is in bounds or not. When the neighborhood overlaps
> > the boundary, there are still inbounds pixels within the 
> > neighborhood that he can perform his calculations (inter pixel
> > statistics).
> > 
> > Jim
> > 
> > 
> > 
> > -----Original Message-----
> > From: Joshua Cates [mailto:cates at sci.utah.edu]
> > Sent: Thursday, July 29, 2004 4:02 PM
> > To: Zachary Pincus
> > Cc: insight-users List
> > Subject: Re: [Insight-users] Finding out when a neighborhood iterator is
> > outside the image?
> > 
> > 
> > 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
> > > 
> > 
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org
> > http://www.itk.org/mailman/listinfo/insight-users
> > _______________________________________________
> > 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