<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><div id="yiv275392215"><span class="Apple-style-span" style="font-size: medium;"><span class="Apple-style-span" style="font-size: 13px; ">As you indicated the way I activated the offsets would create a ball except for a<div><br><div>neighborhood with 1 pixel radius. I think the source of the error is that when you</div><div><br></div><div>assign a region for a neighborhood iterator even if its smaller than the whole image</div><div><br></div><div>the neighborhood iterator still would only iterate over that region and not outside </div><div><br></div><div>(even though your image is defined outside the region, validity of the pixels is defined</div><div><br></div><div>inside the region only), so the solution is either not to refer to out of bound pixels in </div><div><br></div><div>the first and last rows and columns or to use
the face calculator to handle the boundary</div><div><br></div><div>checking. I used the face calculator in a similar example and didn't get any errors.</div><div><br></div><div>Regards,</div><div><br></div><div>Dawood</div><div><br></div><div><div><br>--- On <b>Sun, 11/14/10, David Doria <i><daviddoria@gmail.com></i></b> wrote:<br><blockquote style="border-left-width: 2px; border-left-style: solid; border-left-color: rgb(16, 16, 255); margin-left: 5px; padding-left: 5px; "><br>From: David Doria <daviddoria@gmail.com><br>Subject: Re: ShapedNeighborhoodIterator problem<br>To: "Dawood Masslawi" <davoud_zzz@yahoo.com><br>Cc: insight-users@itk.org<br>Date: Sunday, November 14, 2010, 8:17 AM<br><br><div id="yiv2132021871"><div><div class="yiv2132021871gmail_quote">On Sun, Nov 14, 2010 at 5:42 AM, Dawood Masslawi <span dir="ltr"><<a rel="nofollow" ymailto="mailto:davoud_zzz@yahoo.com" target="_blank"
href="/mc/compose?to=davoud_zzz@yahoo.com">davoud_zzz@yahoo.com</a>></span>wrote:<br><blockquote class="yiv2132021871gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; "><table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" style="font: inherit; "><span style="font-size: medium; "><pre>David,</pre><pre><br></pre><pre>The iterator.IsAtEnd(); command is correct and is not the cause of</pre><pre><br></pre><pre>the crash but the fact that you are activating the offsets without</pre><pre><br></pre><pre>boundary checking can cause errors when you iterate over out of bound</pre><pre><br></pre><pre>pixels. To handle the boundary pixels more efficiently you should use</pre><pre><br></pre><pre>the FaceList which divides the image into boundary and
non-boundary</pre><pre><br></pre><pre>regions so you won't have to check for boundaries. I took the liberty</pre><pre><br></pre><pre>of editing your code and also placed some comments, hope that
helps.</pre><pre><br></pre><pre>regards,</pre><pre><br></pre><font color="#888888"><pre>Dawood</pre></font></span></td></tr></tbody></table></blockquote><div><br></div><div>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)?</div><div><br></div><div>Can you explain why this still crashes?</div><a rel="nofollow" target="_blank" href="http://www.vtk.org/Wiki/ITK/Examples/Broken/Images/ShapedNeighborhoodIterator">http://www.vtk.org/Wiki/ITK/Examples/Broken/Images/ShapedNeighborhoodIterator</a><div><br></div><div><a rel="nofollow" target="_blank" href="http://www.vtk.org/Wiki/ITK/Examples/Broken/Images/ShapedNeighborhoodIterator"></a>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.</div><div><br></div><div>Thanks for your help so far,</div><div><br></div><div>David </div></div></div></div></blockquote></div></div></div></span></span></div></td></tr></table><br>