[Neuroimaging] [nibabel] Loading data directly instead of using a memmap
stjeansam at gmail.com
Thu Jan 14 06:24:40 EST 2016
Oh, a simple fix after all, thanks!
2016-01-14 12:14 GMT+01:00 Nathaniel Smith <njs at pobox.com>:
> On Thu, Jan 14, 2016 at 2:28 AM, Samuel St-Jean <stjeansam at gmail.com>
> > 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
> > 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,
> > 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
> > 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?
> It costs a few hundred bytes of memory, and otherwise will act
> identically except that you lose access to the special mmap methods. I
> wouldn't worry about it :-).
> Nathaniel J. Smith -- http://vorpus.org
> Neuroimaging mailing list
> Neuroimaging at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Neuroimaging