[Insight-users] index to (neighborhood) iterator

Gao, Yi gaoyi.cn at gmail.com
Mon Feb 8 23:19:48 EST 2010


Dear all,

This might be a silly question but is it possible to obtain a
neighborhoodIterator from an index, with the center-of-neighborhood
being that index?

In fact this scenario is:

1st. I need to access arbitrary pixel value. So I have no choice but
use things like GetPixel({{ix, iy, iz}})

2nd. After at (ix, iy, iz), I want to compute the image gradient (1st
order finite difference) there so I need to traverse its neighbors
regularly.

Currently I'm using something like GetPixel({{ix+1, iy, iz}}) -
GetPixel({{ix-1, iy, iz}}) but I know it's slow.

Is there a way to obtain an neighborhoodIterator from idx, then at
least the 2nd step can be accelerated?


Thanks in advance for any hint!


Best
yi


More information about the Insight-users mailing list