From c47764c97d393210be408ab769043fd803741a95 Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauldmccarthy@gmail.com> Date: Sat, 21 Oct 2017 13:38:21 +0100 Subject: [PATCH] Only patch read_segments for nibabel==2.1.0 --- fsl/data/image.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fsl/data/image.py b/fsl/data/image.py index 1eb55c413..9b5d6bd57 100644 --- a/fsl/data/image.py +++ b/fsl/data/image.py @@ -1457,6 +1457,9 @@ def read_segments(fileobj, segments, n_bytes): return bytes -# Monkey-patch the above implementation into nibabel -fileslice.orig_read_segments = fileslice.read_segments -fileslice.read_segments = read_segments +# Monkey-patch the above implementation into +# nibabel. FSLeyes requires at least 2.1.0 - +# newer versions do not need to be patched. +if nib.__version__ == '2.1.0': + fileslice.orig_read_segments = fileslice.read_segments + fileslice.read_segments = read_segments -- GitLab