Skip to content
Snippets Groups Projects
Commit 76afc631 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

BF: Make sure only the first few bytes of the image are read when detecting memmaps

parent 918f084d
No related branches found
No related tags found
No related merge requests found
......@@ -1171,7 +1171,9 @@ class Image(Nifti):
# memory-mapped, nibabel does all of
# the hard work.
newnibimage = False
ismmap = isinstance(self[0, 0, :10], np.memmap)
sample = self[(slice(0, 5),) + (0,) * (len(self.shape) - 1)]
ismmap = isinstance(sample, np.memmap)
if self.__fileobj is None and (not ismmap):
nib.save(self.__nibImage, filename)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment