ExtentIterator

In-source documentation for ExtentIterator

An ExtentIterator provides a self-contained, 'Java' style iterator, which is implicitely convertible to Point. It is initialized with an Extent, and iterates through all points within the volume.

In order to iterate over the complete extent of an image, an iplt::ExtentIterator is used. This is a self-contained, Java style iterator, in contrast to the iterators used in the STL. It is initialized with an iplt::Extent, and is implicitely convertible to a iplt::Point. Each increment will return the next point, until the AtEnd?() method returns true.

Typical usage in C++ would be

ImageHandle img=some_image_handle();
for(ExtentIterator it(img.GetExtent()); !it.AtEnd(); ++it) {
  Real v = img.GetReal(it); // implicit conversion to Point
}

or in Python

img=some_image_handle()
for it in img.GetExtent():
  v=img.GetReal(it)