As you iterate the image, check to see if you&#39;re on the grid. If you are, then set and iterate the neighborhood. Something like:<div><br></div><div>while(!it.IsAtEnd())</div><div>  {</div><div>  index = it.GetIndex();</div>

<div>  if( (index[0] % 2 == 0) &amp;&amp; (index[1] % 3 == 0) )  // or whatever</div><div>    {</div><div>    neighborhoodIt.SetLocation(index);</div>
<div>    // iterateTheNeighborhood</div><div>    .</div><div>    .</div><div>    .</div><div>    }</div><div><br></div><div>  ++it;</div><div>  }<br><br><div class="gmail_quote">On Wed, Feb 16, 2011 at 12:40 PM, linjiao <span dir="ltr">&lt;<a href="mailto:jiao.lin@gmail.com" target="_blank">jiao.lin@gmail.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Have a question regarding neighborhood iterator. My understanding is that<br>
after creating a neighborhood iterator, one can move the center of a<br>
neighborhood around an image region by increment the iterator:<br>
<br>
while (!it.IsAtEnd()) {<br>
 ...<br>
 ++it;<br>
}<br>
<br>
Each increment will bring the center to the next pixel in the image region.<br>
I am now wondering if it is possible to define a &quot;grid&quot; in the image region,<br>
and only let the center to move to the next pixel in that grid.<br>
<br>
So for example, we have a 10X10 image, right now we can define a<br>
neighborhood iterator whose center walks like this<br>
<br>
(0,0), (1,0), (2,0), .... (9,0), (0,1), (1,1) ....<br>
<br>
I am wondering if we can define a neighborhood iterator whose center walks<br>
in 2 steps in x direction, and 3 steps in y direction<br>
<br>
(0,0), (2,0), (4,0), ... (8,0), (0,3), (2,3), (4,3), ...<br>
<br>
Any hints are very appreciated.<br>
<br>
--Jiao<br>
--<br>
View this message in context: <a href="http://old.nabble.com/neighborhood-iterator-tp30936654p30936654.html" target="_blank">http://old.nabble.com/neighborhood-iterator-tp30936654p30936654.html</a><br>
Sent from the ITK - Users mailing list archive at Nabble.com.<br>
<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote></div><br></div>