Update: This morning I submitted Patch Set 19, which can be reviewed, and possibly merged…
itkNeighborhoodRange.h has significant improvements to the reference
types, NeighborhoodRange::iterator::reference
(the return type of iterator::operator*()
), and NeighborhoodRange::const_iterator::reference
. Under the hood, these types are proxy types: Patch Set 19 implements them by an internal (private) template class, PixelProxy<VIsConst>
. (VIsConst
is true for const access to the pixel, and false for non-const access). Both const and non-const PixelProxy
now have a private helper object of type PixelProxyHelper<VIsConst>
, which communicates with the NeighborhoodAccessor of the image (calling NeighborhoodAccessor.Get(internalPixel)
and NeighborhoodAccessor.Set(internalPixel, pixelValue)
).
Tests were added to itkNeighborhoodRangeGTest.cxx to check that the reference
types behave like real (built-in) C++ reference types (PixelType &
and const PixelType &
), and to check that a neighborhood iteration on an itk::VectorImage
is also supported well.
Please have a look!