<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri, sans-serif" size="2">
<div>Hello,</div>
<div> </div>
<div>Thanks for your time in advance.</div>
<div> </div>
<div>So what I am trying to do is to iterate through the region of the image with a neighborhood iterator but instead of letting the center pixel of the neighborhood iterator visit all image pixels I want it sort of jump to pixels spaced at constant intervals.
So say I force the Neighborhood iterator to start at pixel (10,10) by using " Iterator.SetLocation() " and assuming a constant step of 10, how can I force the neighborhood iterator to jump to pixel (20,10) for the 2nd iteration then to pixel (30,10) at the
3rd iteration and so on.. ? </div>
<div> </div>
<div>I tried defining an Offset " itk::Offset <2> BlockOffset " such that " BlockOffset[0] = 10 " and " BlockOffset[1] = 10 ". Plugging that into the Neighborhood Iterator for loop " BlockIterator += (BlockOffset) " I found out that the neighborhood will jump
in a diagonal manner through the image. Afterwards, I redefined " BlockOffset[0] = 10 " while " BlockOffset[1] = 0 ", the iterator moved as planned in the x-direction jumping at regular steps of 10 pixels as needed however, it did not move to the next row
of the image i.e. the neighborhood iterator kept moving in the x-direction even after exceeding the image x-dimension until a RunTime error occurred! </div>
<div> </div>
<div>I tried to introduce " NeedToUseBoundaryConditionOn() " and a Face Calculator " itk::ImageBoundaryFacesCalculator " with no success. Please note the region supplied to the iterator is well defined ( as a OutputImage->GetLargestPossibleRegion() ) and the
problem did not occur when I used the regular Neighborhood Iterator which starts at " BlockIterator.GoToBegin() " and incremented 1 pixel at a time (BlockIterator++). It appears that the Neighborhood iterator algorithm moves to the next row only if it encounters
the pixel that is just outside the required region, therefore, when jumping at particular steps this pixel is almost never visited instead the iterator jumps to a pixel that is some distance outside the requested region and thus it does not go to the next row.
</div>
<div> </div>
<div>So far I was forced to use the latter approach (starting at the 1st pixel in the image and incrementing by 1 pixel at each neighborhood iteration) with Getting the Image Index of the center of the Neighborhood iterator at the current iteration, checking
wither it is at the desired location, and proceeding with computations if it is the case:</div>
<div> </div>
<div>for (BlockIterator.GoToBegin(); !BlockIterator.IsAtEnd(); BlockIterator++) {</div>
<div> BlockCenter = BlockIt.GetIndex();</div>
<div> </div>
<div> if (BlockCenter[0] % StepSize == 0 && BlockCenter[1] % StepSize == 0 && BlockCenter[0] != 0 && BlockCenter[1] != 0)</div>
<div> {</div>
<div> //Proceed with computations</div>
<div> }</div>
<div>}</div>
<div> </div>
<div> However, this approach is hardly efficient. Please Advise. </div>
<div> </div>
<div>Regards</div>
<div> </div>
<div>Denis</div>
<div><font face="Calibri, sans-serif"> </font></div>
<div><font face="Calibri, sans-serif"> </font></div>
</font>
</body>
</html>