<div class="gmail_quote">On Wed, Jul 18, 2012 at 3:53 PM, Hernan Ledesma <span dir="ltr"><<a href="mailto:fledesma@inti.gob.ar" target="_blank">fledesma@inti.gob.ar</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I'm reading The ITK Software Guide: Neighborhood Iterator.<br>
<br>
I don't undestand this:<br>
<br>
NeighborhoodIteratorType::<u></u>OffsetType offset1 = {{-1,-1}};<br>
<br>
Why are there two nested curly braces?<br>
<br>
Is offset1 a multidimensional array?<br>
<br>
thanks!<br><br></blockquote><div class="gmail_quote"><br></div>It is equivalent to </div><div class="gmail_quote"><br></div><div class="gmail_quote">NeighborhoodIteratorType::<u></u>OffsetType offset1;</div><div class="gmail_quote">
offset[0] = -1;</div><div class="gmail_quote">offset[1] = -1;</div><div class="gmail_quote"><br clear="all">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.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">That NeighborhoodIteratorType::OffsetType is just a typedef for some itk::Offset<N> (see <a href="http://www.itk.org/Doxygen/html/classitk_1_1Offset.html">http://www.itk.org/Doxygen/html/classitk_1_1Offset.html</a> for details). </div>
<div class="gmail_quote"><br></div><div class="gmail_quote">That is, in your case </div><div class="gmail_quote"><br></div><div class="gmail_quote">NeighborhoodIteratorType::<u></u>OffsetType offset1;</div><div class="gmail_quote">
<br></div><div class="gmail_quote">is equivalent to</div><div class="gmail_quote"><br></div><div class="gmail_quote">itk::<u></u>Offset<2> offset1;</div><div class="gmail_quote"><br></div><div class="gmail_quote">Hope that helps,</div>
<div class="gmail_quote"><br>David</div>