From c11e9a7fb703d720ed441e8fc320b868d48bf526 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Wed, 13 Dec 2017 18:40:17 +1030
Subject: [PATCH] DICOM images are force-loaded into memory

---
 fsl/data/dicom.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fsl/data/dicom.py b/fsl/data/dicom.py
index bf1bb5de4..88d4f6023 100644
--- a/fsl/data/dicom.py
+++ b/fsl/data/dicom.py
@@ -206,6 +206,9 @@ def loadSeries(series):
             sp.call(cmd.split(), stdout=devnull, stderr=devnull)
 
         files  = glob.glob(op.join(td, '{}.nii'.format(snum)))
-        images = [nib.load(f, mmap=False) for f in files]
+        images = [nib.load(f) for f in files]
+
+        # Force-load images into memory
+        [i.get_data() for i in images]
 
         return [DicomImage(i, series, name=desc) for i in images]
-- 
GitLab