diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ba122c57b9006f859c4c9898d407f61b536af20b..42815f289500ee9892044ca6276ccd8c9fb8496b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -27,19 +27,26 @@ Changed vertex data. +Removed +^^^^^^^ + +* Many deprecated items removed. + + +1.13.3 (Friday February 8th 2019) +--------------------------------- + + Fixed ^^^^^ + +* Fixed an issue with the `.dicom.loadSeries` using memory-mapping for + image files that would subsequently be deleted. * Fixed an issue in the :class:`.GiftiMesh` class, where ``numpy``/``nibabel`` was returning read-only index arrays. -Removed -^^^^^^^ - -* Many deprecated items removed. - - 1.13.2 (Friday November 30th 2018) ---------------------------------- diff --git a/fsl/data/dicom.py b/fsl/data/dicom.py index 1457c54eed7f4e017500de67d033f5b4b5626052..f7c9a97c785dcdcdc4f4ddc57f55d06b58a436a2 100644 --- a/fsl/data/dicom.py +++ b/fsl/data/dicom.py @@ -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]