[Insight-users] ShapedNeighborhoodIterator problem

Dawood Masslawi masslawi at gmail.com
Sun Nov 14 08:50:11 EST 2010


As you indicated the way I activated the offsets would create a ball except for a
neighborhood with 1 pixel radius. I think the source of the error is that when you
assign a region for a neighborhood iterator even if its smaller than the whole image
the neighborhood iterator still would only iterate over that region and not outside 
(even though your image is defined outside the region, validity of the pixels is defined
inside the region only), so the solution is either not to refer to out of bound pixels in 
the first and last rows and columns or to use the face calculator to handle the boundary
checking. I used the face calculator in a similar example and didn't get any errors.
Regards,
Dawood

--- On Sun, 11/14/10, David Doria <daviddoria at gmail.com> wrote:

From: David Doria <daviddoria at gmail.com>
Subject: Re: ShapedNeighborhoodIterator problem
To: "Dawood Masslawi" <masslawi at gmail.com>
Cc: insight-users at itk.org
Date: Sunday, November 14, 2010, 8:17 AM

On Sun, Nov 14, 2010 at 5:42 AM, Dawood Masslawi <masslawi at gmail.com>wrote:
David,
The iterator.IsAtEnd(); command is correct and is not the cause of
the crash but the fact that you are activating the offsets without
boundary checking can cause errors when you iterate over out of bound
pixels. To handle the boundary pixels more efficiently you should use
the FaceList which divides the image into boundary and non-boundary
regions so you won't have to check for boundaries. I took the liberty
of editing your code and also placed some comments, hope that
 helps.
regards,
Dawood
Hm, I actually thought about that, that's why I had that "small region" code (commented) in there. I have modified the code so that it is iterating over a completely valid region of the image, and it still crashes. Also, the way you activated the offsets would create a ball, not a cross, right (maybe not in the R=1 case, but generally)?
Can you explain why this still crashes?http://www.vtk.org/Wiki/ITK/Examples/Broken/Images/ShapedNeighborhoodIterator
In the mean time, I'll look into the ImageBoundaryFacesCalculator. It seems like since the shaped neighborhood iterator doesn't work yet on a manually specified internal region that it would have same the same problem on the first region (the internal region) in the FaceList that is computed. I'm trying to get it working from the "ground up" before adding this additional component.
Thanks for your help so far,
David 


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101114/966adb1c/attachment.htm>


More information about the Insight-users mailing list