<div>Then you may try something like this (I haven&#39;t compiled it properly, may contain errors)</div><div><br></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">typedef itk::ConstNeighBorhoodIterator&lt;SOME_ITK_IMG_TYPE&gt; IteratorType;</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">IteratorType::RadiusType radius;</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">radius.Fill(1); // this is equivalent to 3x3x3 neigborhood</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">IteratorType nit( radius, my_image, my_image-&gt;GetLargestPossibleRegion());</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">for(nit.GotoBegin(); !nit.IsAtEnd(); ++it) { // this first loop moves the iterator to all the voxels</font></div>
<div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">  for (size_t i = 0; i &lt; nit.Size(); ++i) { // this loop moves inside the 3x3x3 neighborhood</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    SOME_ITK_IMG_TYPE::PixelType = nit.GetPixel( i ); </font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    // do something with the voxel</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">  }</font></div></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">}</font></div><div><br></div><div>HTH</div><br><div class="gmail_quote">On Fri, Mar 4, 2011 at 10:06 AM, Wang Zhimin <span dir="ltr">&lt;<a href="mailto:zwang@i2r.a-star.edu.sg">zwang@i2r.a-star.edu.sg</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word"><div>Hi, Sergio,</div><div><br></div><div>That&#39;s my bottom line to achieve my goal. Currently I am looking for options that can do it in a better way. Else I will just process 3 slices in 2D way at each iteration to visit all the 26 neighborhood voxels. </div>
<div><br></div><div>Regards,</div><div>Zhimin</div><div><div></div><div class="h5"><div><br></div><br><div><div>On 04-Mar-2011, at 5:02 PM, Sergio Vera wrote:</div><br><blockquote type="cite">Hi Zhimin<div><br></div><div>
Yes, indeed you can use a radius of 1x1x1 to obtain a 3x3x3 region and hace access to the full 26 Neighborthood.</div><div><br></div><div>However, if you are interested in processing the 3x3x3 region slice by slice (I understood this from your first email) you should use 1x1x0 radius, process the slice, and then move the iterator upwards or downwards to the next slice: even if the neighborhood region of the iterator is 2D (3x3x0) the iterator itself can move freely in 3D within the image.</div>

<div><br></div><div>Regards</div><div><br><div class="gmail_quote">On Fri, Mar 4, 2011 at 9:57 AM, Wang Zhimin <span dir="ltr">&lt;<a href="mailto:zwang@i2r.a-star.edu.sg" target="_blank">zwang@i2r.a-star.edu.sg</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Hi, Sergio</div><div><br></div><div>Thank you very much.</div><div><br></div><div>

My image is volume image (3D), not planar image (2D). Actually, I want something like radius of 1x1x1, neighbor hood voxels size of 26 (3x3x3 - 1).</div><div><br></div><div>Do you know how to do that?</div><div><br></div>

<div>Regards,</div><div>Zhimin</div><div><div></div><div><div><br></div><br><div><div>On 04-Mar-2011, at 4:48 PM, Sergio Vera wrote:</div><br><blockquote type="cite">Hello Zhimin<div><br></div><div>Try <span style="font-family:monospace;font-size:12px"><a href="http://www.itk.org/Doxygen320/html/classitk_1_1NeighborhoodIterator.html" style="color:rgb(26, 65, 168);text-decoration:none;font-weight:bold" target="_blank">itk::NeighborhoodIterator</a></span></div>


<div><font face="monospace"><span style="font-size:12px"><br></span></font></div><div><a href="http://www.itk.org/Doxygen320/html/classitk_1_1NeighborhoodIterator.html" style="color:rgb(26, 65, 168);text-decoration:none;font-weight:bold" target="_blank"></a><span style="font-size:12px"><font face="arial, helvetica, sans-serif">(or it&#39;s const variant). You can initialize it with your image, your desired region and setting a radius of 1x1x0 with SetRadius member function. to define a neighborhood of 3x3x0 in the z axis plane. Then you can put the iterator at each slice with the SetLocation function.</font></span></div>


<div><span style="font-size:12px"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><span style="font-size:12px"><font face="arial, helvetica, sans-serif">Once your iterator is centered at each voxel, you can actually read it&#39;s neighborhood using the GetPixel(i) method. With your neighborhood of 3x3x0, i must be between 0 and 9.</font></span></div>


<div><span style="font-size:12px"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><span style="font-size:12px"><font face="arial, helvetica, sans-serif">HTH</font></span></div>
<div><span style="font-size:12px"><font face="arial, helvetica, sans-serif"><br></font></span></div><div><span style="font-size:12px"><font face="arial, helvetica, sans-serif">Sergio</font></span></div>
<div><br><div class="gmail_quote">On Fri, Mar 4, 2011 at 8:43 AM, Wang Zhimin <span dir="ltr">&lt;<a href="mailto:zwang@i2r.a-star.edu.sg" target="_blank">zwang@i2r.a-star.edu.sg</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Hi, all,<br>
<br>
Thank you all in advance for reading this question.<br>
<br>
I am looking for a way to read all the neighborhood voxels for a 3x3x3 neighboring window for a 3D volume image.<br>
<br>
I find all the online resource, itksoftwareguide, itk example, and mailing list archive, all failed.<br>
<br>
Can any one give me some example codes to do this?<br>
<br>
Some notes:<br>
1) I think a ImageSliceIteratorWithIndex may work, but I cannot figure out HOW through the example.<br>
2) I want to use 2D neighborhood iterator for each slice, but I need to coordinate at least 3 slices (previous, center, and next) with correct index, and it is too complicated.<br>
3) I also want to use itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator to get the non-boundary region, I don&#39;t have any boundary condition, so what I need is just to focus on the non-boundary region.<br>
<br>
Once again, thank you.<br>
<br>
Regards,<br>
Zhimin<br>
<br>
Institute for Infocomm Research disclaimer:  &quot;This email is confidential and may be privileged. If you are not the intended recipient, please delete it and notify us immediately. Please do not copy or use it for any purpose, or disclose its contents to any other person. Thank you.&quot;<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><br clear="all"><br>-- <br>Sergio Vera<br><br> Alma IT Systems<br> C/ Vilana, 4B, 4º 1ª<br> 08022 Barcelona<br> T. (+34) 932 380 592<br> <a href="http://www.alma3d.com/" target="_blank">www.alma3d.com</a><br>


</div>
</blockquote></div><br>
<div>
Institute for Infocomm Research disclaimer:  &quot;This email is confidential and may be privileged. If you are not the intended recipient, please delete it and notify us immediately. Please do not copy or use it for any purpose, or disclose its contents to any other person. Thank you.&quot;<br>


</div></div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br>Sergio Vera<br><br> Alma IT Systems<br> C/ Vilana, 4B, 4º 1ª<br> 08022 Barcelona<br> T. (+34) 932 380 592<br> <a href="http://www.alma3d.com/" target="_blank">www.alma3d.com</a><br>

</div>
</blockquote></div><br>
<div>
Institute for Infocomm Research disclaimer:  &quot;This email is confidential and may be privileged. If you are not the intended recipient, please delete it and notify us immediately. Please do not copy or use it for any purpose, or disclose its contents to any other person. Thank you.&quot;<br>

</div></div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br>Sergio Vera<br><br> Alma IT Systems<br> C/ Vilana, 4B, 4º 1ª<br> 08022 Barcelona<br> T. (+34) 932 380 592<br> <a href="http://www.alma3d.com">www.alma3d.com</a><br>