[Insight-users] A question about neighborhood iterator and image iterator

Luis Ibanez luis . ibanez at kitware . com
Fri, 03 Oct 2003 20:34:13 -0400


Hi Feng,

Thanks for pointing this out.

Strictly speaking, nothing ensures that the two iterators
will use the same algorithm for visiting the image.

However, in practice we know that the internal implementation
of both iterators use the same algorithm for visiting all the
pixels, so we can count on their indices to be synchronized.

That will not be the case with the ImageLinearIterator, or the
ImageSliceIterator, or the ImageReflectiveIterator....

This combination of iterators must be done with some caution.



Regards,


   Luis


------------------
Feng Ma wrote:
> Hi, Josh and Luis:
> 
>  I am a little confused about how to use neighborhood iterator and image 
> iterator. Josh has a code example in ITK Neighborhood ppt file:
> 
>    typedef itk::Image<float, 3> ImageType;
>    ImageType::Pointer image = SomeImageSource->GetOutput();
> 
>    itk::ConstNeighborhoodIterator<ImageType> it(radius, image,
>                                                        
> image->GetRequestedRegion());
>    itk::ImageRegionIterator<ImageType> out(output_image,
>                                        image->GetRequestedRegion());
> 
>    for (it.GoToBegin(); ! it.IsAtEnd(); ++it, ++out)
>    {
>       out.Set(0.5 * it.GetNext(2) -  0.5 * it.GetPrevious(2));
>    }
> 
>  How does ITK internal mechanism make sure that neighborhood iterator it 
> and image region iterator out are always visiting the same pixel in image?
> 
>  Thanks.
> 
> -Feng
> 
> _________________________________________________________________
> Share your photos without swamping your Inbox.  Get Hotmail Extra 
> Storage today! http://join . msn . com/?PAGE=features/es
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>