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

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

parent 5bab6952
No related branches found
No related tags found
No related merge requests found
......@@ -203,9 +203,13 @@ def loadSeries(series):
sp.call(cmd.split(), 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]
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