[Insight-developers] Bug in ImageLinearIterator class?

Paul Hughett hughett@mercur.uphs.upenn.edu
Tue, 8 May 2001 14:32:14 -0400


The documentation for the ImageLinearIterator class states that a 
simple loop such as

  // Fill image with a ramp
  itk::ImageLinearIterator<ImageType> iter(image, region);
  itk::ImageLinearIterator<ImageType>::IndexType index;
  PixelType value;
  for (iter.Begin(); !iter.IsAtEnd(); ++iter) {
    index = iter.GetIndex();
    value = index[0] + index[1];
    iter.Set(value);
  }

can be used to iterate over all the pixels of a region.  But when I
try it, I get a seg fault, and when I look at the code for
ImageLinearIterator, it doesn't seem to handle the "carriage return"
at the end of each image row.

It would seem that either the code or the documentation needs to be
fixed.


Paul Hughett