[Neuroimaging] [nibabel] Loading data directly instead of using a memmap

Samuel St-Jean stjeansam at gmail.com
Thu Jan 14 05:28:49 EST 2016


Hello,

While processing some hcp data, we decided to use directly nifti files
instead of using gzipped file as they use quite a lot of ram (there are
some PRs fixing this under the work in nibabel apparently). So when you
load a regular nifti file, it gets a memmap instead of a proper numpy
array, which does not support the same feature and sometimes ends up
producing really weird bugs down the line (
https://github.com/numpy/numpy/issues/6750).

So, we just ended up casting the memmap to a regular numpy array with
something like

data = np.array(data)

While this works, is it memory usage friendly (hcp data is ~4go after all)
or does it keep a reference in the background? Is there a better way to
achieve similar results, like for example forcing nibabel to load a numpy
array directly instead of memmap?

If anyone has suggestions for better usability, feel free to share.

Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20160114/561fcdf6/attachment.html>


More information about the Neuroimaging mailing list