[Insight-developers] Iterators return by value? (ConditionalIterator implementation)

Bradley Lowekamp blowekamp at mail.nih.gov
Mon Apr 23 16:02:24 EDT 2012


Hello,

I have encountered problems because the ConditionalInterators are returning by reference and not value. Specifically, the following function signature is problematic for VectorImages:

const PixelType & Get(void) const;


This signature is different then the more commonly used ImageRegion iterators or NeighborhoodIterator. Where it is simply:

PixelType Get() const;

As the later types of iterators are the most commonly used, and I presume they appear to have quite a reasonable performance characteristics, I believe that is the way to go to make all the iterator interfaces more uniform.

Additionally, the return by reference is not compatible with the VectorImage's VariableLengthVector which is used through out SimpleITK. Specifically I am currently in the progress of getting the VectorConfidenceConnectedImageFilter to work with VectorImages.

I am e-mailing the developers list to see if any one is aware of the history of why these iterators have diverged. Or are there other specific concerns.

There is a surprisingly simple patch for this issue in gerrit:
http://review.source.kitware.com/#/c/5295/1

Thanks,
Brad

========================================================
Bradley Lowekamp  
Medical Science and Computing for
Office of High Performance Computing and Communications
National Library of Medicine 
blowekamp at mail.nih.gov



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20120423/eeb25746/attachment.htm>


More information about the Insight-developers mailing list