[Insight-users] What is GetNeighborhoodIndex of the ShapedNeighborhoodIterator?

David Doria daviddoria at gmail.com
Mon Jul 18 12:32:02 EDT 2011


On Mon, Jul 18, 2011 at 10:35 AM, Dawood AlMasslawi <masslawi at gmail.com>wrote:

> Following the same logic it should return the neighborhood index of
>>
>> the pixel which the constant iterator is currently accessing.
>>
>> In the wiki example since the radius of the neighborhood is set
>>
>> equal to the size of the image I guess it returns the number of the pixel
>>
>> as the iterator walks from the top left to the bottom right.
>>
>> Hence the neighborhood index would start with 0 and end with
>>
>> number of pixels minus 1.
>>
>> Still, 199 and 241 seems a bit much, the image has only 100 pixels!!
>>
>>
>> Dawood
>>
>
I see. I changed it to:

itk::Size<2> radius;
radius.Fill(1);
IteratorType iterator(radius, image, image->GetLargestPossibleRegion());

and now the output is:

New position:
At [0, 0]
1 -> [0, -1] = 0
At [0, 0]
7 -> [0, 1] = 0

Which makes sense, because I set the (0,1) and (0,-1) pixels as active, so
if the neighborhood positions are indexed as:

0 1 2
3 4 5
6 7 8

that makes sense. I don't know what the issue was with the larger radius -
maybe it just isn't designed to have a radius on the order of the size of
the image?

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110718/8afaf3b3/attachment.htm>


More information about the Insight-users mailing list