[Numpy-discussion] Change default order to Fortran order

Sturla Molden sturla.molden at gmail.com
Mon Aug 3 12:01:09 EDT 2015


Matthew Brett <matthew.brett at gmail.com> wrote:

> Sure, but to avoid confusion, maybe move the discussion of image
> indexing order to another thread?
> 
> I think this thread is about memory layout, which is a different issue.

It is actually a bit convoluted and not completely orthogonal. Memory
layout does not matter for 2d ndexing, i.e. (x,y) vs. (row, column), if you
are careful when iterating, but it does matter for Nd indexing. There is a
reason to prefer (x,y,z,t,r) in column major order or (recording, time,
slice, row, column) in row major order. Otherwise you can get very
inefficient memory traversals. Then if you work with visualization
libraries that expects (x,y,z) and column major order, e.g. ITK, VTK and
OpenGL, this is really what you want to use. And the choise of indexing
(x,y,z) cannot be seen as independent of the memory layout. Remember, it is
not just a matter of mapping coordinates to pixels. The data sets are so
large in MRI processing that memory layout does matter.

Sturla




More information about the NumPy-Discussion mailing list