From 75fa408e7bcf2e69415d1e3017ce48bf4367a11d Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Fri, 7 Sep 2018 12:15:11 +0100
Subject: [PATCH] BF: Allow open slice endings

---
 fsl/data/imagewrapper.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fsl/data/imagewrapper.py b/fsl/data/imagewrapper.py
index d2b4fb916..559c0d974 100644
--- a/fsl/data/imagewrapper.py
+++ b/fsl/data/imagewrapper.py
@@ -825,6 +825,8 @@ def expectedShape(sliceobj, shape):
         if start is None: start = 0
         if stop  is None: stop  = shape[i]
 
+        stop = min(stop, shape[i])
+
         expShape.append(stop - start)
 
     return len(expShape), expShape
-- 
GitLab