diff --git a/fsl/data/image.py b/fsl/data/image.py index 1eb55c413a02f23f16f7cfaa26769c77d79c2027..9b5d6bd575f8639bfbaff9169eac37bba53b9e78 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