From 195cb21f7d68b73737a9fd2d39023cc79b6a4fc3 Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Fri, 27 Mar 2020 16:20:56 +0000
Subject: [PATCH] RF: Hook to get the raw output, for testing

---
 fsl/wrappers/fslstats.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/fsl/wrappers/fslstats.py b/fsl/wrappers/fslstats.py
index b1ccc691b..f77a36723 100644
--- a/fsl/wrappers/fslstats.py
+++ b/fsl/wrappers/fslstats.py
@@ -194,10 +194,13 @@ class fslstats(object):
         return self
 
 
-    def run(self):
+    def run(self, raw=False):
         """Run the ``fslstats`` command-line tool. See :meth:`__init__` for a
         description of the return value.
 
+        :arg raw: Defaults to ``False``. If ``True``, the raw standard output
+                  and error is returned, instead of a scalar/numpy array.
+
         :returns: Result of ``fslstats`` as a scalar or ``numpy`` array.
         """
 
@@ -210,7 +213,11 @@ class fslstats(object):
         # is to tee the command output streams
         # to the calling process streams. We
         # can disable this via log=None.
-        result  = self.__run('fslstats', *self.__options, log=None)
+        result = self.__run('fslstats', *self.__options, log=None)
+
+        if raw:
+            return result.stdout
+
         result  = np.genfromtxt(io.StringIO(result.stdout[0].strip()))
         sepvols = '-t' in self.__options
         lblmask = '-K' in self.__options
-- 
GitLab