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

Merge branch 'bf/detect_mmap' into 'master'

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

See merge request fsl/fslpy!64
parents 918f084d 76afc631
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