Enet4 / nifti-rs

Rust implementation of the NIfTI-1 format
Apache License 2.0
42 stars 12 forks source link

C or F #9

Closed nilgoyette closed 6 years ago

nilgoyette commented 6 years ago

I've been working with this library for several months now and I have written my own nifti writer. It has been tested extensively but it's quite slow! Slower than NiBabel in fact. One of the reason that my writer is slow is that the elements are contiguous BUT not in logical order. I searched and finally found what I wanted in convert_bytes_and_cast_to

Ok(Array::from_shape_vec(IxDyn(&dim).f(), data)
//                                  ^^^^ fortran!

I was wondering why I needed a transpose in my writer but never took the time to investigate. So, after all this text... Do you remember why you wanted the memory to be in Fortran mode? It's kind of surprising to me, and probably to many users of ndarray.

Enet4 commented 6 years ago

Great catch! I don't quite remember why I did that, and I agree that this is not a very good default. Given the state of things, I am not opposed to changing this to row major order and bumping a new release (v0.6.0).

I'm not sure when I'll be able to pick this up, so a PR would be much appreciated!

nilgoyette commented 6 years ago

Closing because we discovered (or remembered) in #10 that we need the fortran order!