[Insight-users] Help with moving NeighborhoodIterator with an offset

David Doria daviddoria at gmail.com
Mon Dec 5 11:01:52 EST 2011


On Mon, Dec 5, 2011 at 10:57 AM, anna han wan <anna.han.wan at gmail.com> wrote:
> Hi all,
>
> I am using NeighborhoodIterator to visit all voxels of my image(3D) and to
> do some processing within a rectangular neighborhood. As doing this is a
> time consuming process, I decided to move the iterator with an offset rather
> than visiting every voxel. When I run my code I got the following error:
>
>
>
> Unhandled exception at 0x000007fefcceaa7d in main.exe: Microsoft C++
> exception: itk::ExceptionObject at memory location 0x00b4f4a8.
>
>
>
> This is because the iterator has reached the image border. So my question is
> how can I increment the ierator with an offset and check at the same time if
> I reched the image border?  I find the function InBounds but I don’t know
> how to use it properly?

This example demonstrates the overloaded GetPixel(int, bool inbounds):

http://www.itk.org/Wiki/ITK/Examples/Iterators/NeighborhoodIterator

David


More information about the Insight-users mailing list