Commit 94b6e749 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

BF: Avoid mem-mapping dicom/niftis, as the tempdir will be deleted.

parent 5bab6952
......@@ -203,9 +203,13 @@ def loadSeries(series):, stdout=devnull, stderr=devnull)
files = glob.glob(op.join(td, '{}*.nii'.format(snum)))
images = [nib.load(f) for f in files]
# Force-load images into memory
[i.get_data() for i in images]
images = [nib.load(f, mmap=False) for f in files]
# copy images so nibabel no longer
# refs to the files (as they will
# be deleted), and use get_data()
# to force-load the image data.
images = [nib.Nifti1Image(i.get_data(), None, i.header)
for i in images]
return [DicomImage(i, series, dcmdir, name=desc) for i in images]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment