[Insight-developers] performance of image iterators and pixel buffer storage

Dan Mueller dan.muel at gmail.com
Tue Nov 4 11:53:17 EST 2008


Hi David,

> When using an iterator with an ITK image, it is hard to determine whether or
> not the iterator is iterating over a continuous array of memory.

This is the whole point of an iterator: so that users do not have to
worry about that level of abstraction.

> How is the pixel buffer stored in a 2D/3D ITK image?

The buffer is stored an a 1D array of PixelType. The actual array is
stored as an itk::ImportImageContainer.

> row major storage?
> column major storage?
> Is the pixel buffer for a 3D image is stored in a continuous array of
> memory?

See the documentation in itkImage.h:

* The data in an image is arranged in a 1D array as [][][][slice][row][col]
 * with the column index varying most rapidly.  The Index type reverses
 * the order so that with Index[0] = col, Index[1] = row, Index[2] = slice,
 * ...

> which value for
>
>  SetDirection()
>
> should be used to give the best performance?



More information about the Insight-developers mailing list