From 9a30c50ec414bc5419cdf24bd6b0196b212e73af Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Wed, 12 Jun 2019 15:01:13 +0930
Subject: [PATCH] BF: Bug in ImageWrapper for vector images

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

diff --git a/fsl/data/imagewrapper.py b/fsl/data/imagewrapper.py
index 9c4b549ea..8afcccacf 100644
--- a/fsl/data/imagewrapper.py
+++ b/fsl/data/imagewrapper.py
@@ -190,10 +190,10 @@ class ImageWrapper(notifier.Notifier):
             if d == 1: self.__numRealDims -= 1
             else:      break
 
-        # Degenerate case - if every
-        # dimension has length 1
-        if self.__numRealDims == 0:
-            self.__numRealDims = len(image.shape)
+        # Degenerate case - less
+        # than three real dimensions
+        if self.__numRealDims < 3:
+            self.__numRealDims = min(3, len(image.shape))
 
         # And save the number of
         # 'padding' dimensions too.
@@ -705,7 +705,7 @@ class ImageWrapper(notifier.Notifier):
                     raise IndexError('Invalid assignment: [{}] = {}'.format(
                         sliceobj, len(values)))
 
-                values = values[0]
+                values = np.array(values).flatten()[0]
 
             # Make sure that the values
             # have a compatible shape.
-- 
GitLab