On Mon, Aug 3, 2015 at 10:24 AM, Matthew Brett <matthew.br...@gmail.com> wrote:
> On Mon, Aug 3, 2015 at 5:01 PM, Sturla Molden <sturla.mol...@gmail.com> > wrote: > > Matthew Brett <matthew.br...@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. > > I completely agree that memory layout can affect performance, and this > can be important. > > On the other hand, I think you agree that the relationship of axis > order to memory layout is just a matter of mapping coordinates to > pixels. > > So you can change the axis ordering without changing the memory layout > and the memory layout without changing the axis ordering. > > Of course you could argue that it would be simpler to fuse the two > issues, and enforce one memory layout - say Fortran. The result > might well be easier think about, but it wouldn't be much like numpy, > and it would have lots of performance and memory disadvantages. > > Cheers, > I would also strongly suggest that once you have decided on a convention that you thoroughly document it somewhere. That will not only help you, but anyone who later needs to maintain the code will bless you rather than d*nm you to eternal torture by the seven demons of Ipsos. Chuck
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion