ITK  4.13.0
Insight Segmentation and Registration Toolkit
WikiExamples/VectorImages/VectorNeighborhoodIterator.cxx
#include "itkVectorImage.h"
typedef itk::VectorImage<unsigned char, 2> VectorImageType;
int main(int, char*[])
{
// Create an image
VectorImageType::Pointer image = VectorImageType::New();
start.Fill(0);
size.Fill(10);
itk::ImageRegion<2> region(start,size);
image->SetRegions(region);
image->SetNumberOfComponentsPerPixel(3);
image->Allocate();
// Create the neighborhood iterator
radius[0] = 1;
radius[1] = 1;
itk::NeighborhoodIterator<VectorImageType> iterator(radius, image, image->GetLargestPossibleRegion());
while(!iterator.IsAtEnd())
{
iterator.GetCenterPixel();
++iterator;
}
return EXIT_SUCCESS;
}