[Insight-users] Iterator

Miller, James V (Research) millerjv at crd.ge.com
Tue Aug 30 08:11:48 EDT 2005


It sounds like you may be trying to do one of two things:

1. Access (read) pixels values that are more than 1 pixel away, and
2. Increment the iterator by more than 1 pixel.

The former can be done using a radius > 1 for the neighborhood iterator. Any pixel
under the neighborhood can be accessed using the methods GetPixel(i), GetNext(axis, i), 
GetPrevious(axis, i).  (The definition of "i" in each of the above methods is different).
If you are only using some of the entries in a neighborhood, you may want to look at the 
ShapedNeighborhoodIterators.

The latter can be done using operator+=(OffsetType&). However, using this method does not
do any bounds checking.  So if you offset an iterator and that places you outside the region
defined for the iterator, an undefined behavior will result.

Jim



-----Original Message-----
From: insight-users-bounces+millerjv=crd.ge.com at itk.org
[mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of
wlzhu
Sent: Tuesday, August 30, 2005 5:41 AM
To: insight-users at itk.org
Subject: [Insight-users] Iterator


Hi Luis:
When I use itk::NeighborhoodIterator, I need access voxel with const step other than 1. 
Such as :
NeighborhoodIteratorType  it(radius, image,image->GetRequestedRegion());
I need it+=2; or it = it + 2;
I never find itk iterators that have overloaded operator+=(long int i) or operator+(long int i);
 I believe such operators will be great helpful for itk users. 


best 

wanlin
_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list