From 8031646c1c4ef7bb7c754656defb8a77a6c6071b Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Wed, 28 Nov 2018 18:04:16 +0000
Subject: [PATCH] BF: Fix in ImageWrapper r.e. complex images

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

diff --git a/fsl/data/imagewrapper.py b/fsl/data/imagewrapper.py
index b73cb879a..2b49e4af5 100644
--- a/fsl/data/imagewrapper.py
+++ b/fsl/data/imagewrapper.py
@@ -301,7 +301,14 @@ class ImageWrapper(notifier.Notifier):
 
         # Internally, we calculate and store the
         # data range for each volume/slice/vector
-        self.__volRanges = np.zeros((nvols, 2), dtype=np.float32)
+        #
+        # We use nan as a placeholder, so the
+        # dtype must be non-integral
+        dtype = self.__image.get_data_dtype()
+        if np.issubdtype(dtype, np.integer):
+            dtype = np.float32
+        self.__volRanges = np.zeros((nvols, 2),
+                                    dtype=dtype)
 
         self.__coverage[ :] = np.nan
         self.__volRanges[:] = np.nan
-- 
GitLab