[Insight-users] NeighborhoodIterator

David Doria daviddoria at gmail.com
Wed Jul 18 16:04:30 EDT 2012


On Wed, Jul 18, 2012 at 3:53 PM, Hernan Ledesma <fledesma at inti.gob.ar>wrote:

> Hi,
>
> I'm reading The ITK Software Guide: Neighborhood Iterator.
>
> I don't undestand this:
>
> NeighborhoodIteratorType::**OffsetType offset1 = {{-1,-1}};
>
>  Why are there two nested curly braces?
>
>  Is offset1 a multidimensional array?
>
> thanks!
>
>
It is equivalent to

NeighborhoodIteratorType::**OffsetType offset1;
offset[0] = -1;
offset[1] = -1;

I believe it is called an "aggregate initializer". There are two values (in
your case) because it is referring to an offset in a 2D image. Generally
there would be N values for an N-D image offset.

That NeighborhoodIteratorType::OffsetType is just a typedef for some
itk::Offset<N> (see http://www.itk.org/Doxygen/html/classitk_1_1Offset.html for
details).

That is, in your case

NeighborhoodIteratorType::**OffsetType offset1;

is equivalent to

itk::**Offset<2> offset1;

Hope that helps,

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


More information about the Insight-users mailing list