Is support for memory maps discontinued?
Garyfallidis opened this issue · comments
Eleftherios Garyfallidis commented
Hi all,
In the past we could use memory maps with ease directly from Nibabel. My understanding is that this is not any more supported.
Is there an alternative approach?
Chris Markiewicz commented
I assume we're discussing spatial images? Here's the breakdown:
img.dataobj.get_unscaled()
will return amemmap
if the data are uncompressed, and will not apply scalingnp.asanyarray(img.dataobj)
will return amemmap
if the data are uncompressed and there are no scale-factorsimg.dataobj[:]
would also work, but is less explicit
np.asanyarray(img.dataobj, target_dtype)
will return amemmap
if the data are uncompressed, with no scaling, in that dtypeimg.get_fdata(dtype=target_dtype)
will return amemmap
if the data are uncompressed, with no scaling, in that dtype- This will also store a cache of the array on the
img
object.
- This will also store a cache of the array on the
img.get_fdata()
will return amemmap
if the data are uncompressed, float64, with no scale factors
Eleftherios Garyfallidis commented
Yes. Spatial images. Thank you for the quick response @effigies.