[vtk-developers] Image neighborhood iteration

David Doria daviddoria at gmail.com
Sat Oct 9 22:39:17 EDT 2010


It would be nice you could iterate over images with pixel
neighborhoods in VTK as you can in ITK.

I started creating this structure:

class Neighborhood (no specific shape):
* Stores a collection of pointers to pixels
* Stores a pointer to the Image it will refer to

class RectangularNeighborhood (derived from Neighborhood):
* Has a Center and a Size which sets up which pixels to store pointers to.

class PixelIterator:
* Next() function to move the iterator
* GetPixel() function which returns a pointer to the pixel at the
iterators current position.
* Stores a pointer to the Image which it will iterate over.

class NeighborhoodIterator (derived from PixelIterator):
* Stores a pointer to the Neighborhood it will use

The code is here:
git at github.com:daviddoria/vtkImageTraversal.git

PixelIteratorExample works as expected. NeighborhoodIteratorExample
crashes, because the RectangularNeighborhood does not yet set pixels
of the neighborhood properly.

Could I get an initial design review before going farther with this?
If you'd like to help with this, please let me know!

Thanks,

David



More information about the vtk-developers mailing list