From 23ff16c8eaf203fd5b470256d34c16a3bb63c1ae Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Tue, 24 Mar 2020 22:15:54 +0000
Subject: [PATCH] BF: DeformationField.transform works with single set of
 coords

---
 fsl/transform/nonlinear.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fsl/transform/nonlinear.py b/fsl/transform/nonlinear.py
index daf13adcf..77bc212b8 100644
--- a/fsl/transform/nonlinear.py
+++ b/fsl/transform/nonlinear.py
@@ -251,7 +251,9 @@ class DeformationField(NonLinearTransform):
         if from_ is None: from_ = self.refSpace
         if to    is None: to    = self.srcSpace
 
-        coords = np.asanyarray(coords)
+        coords   = np.asanyarray(coords)
+        outshape = coords.shape
+        coords   = coords.reshape((-1, 3))
 
         # We may need to pre-transform the
         # coordinates so they are in the
@@ -299,7 +301,7 @@ class DeformationField(NonLinearTransform):
         outcoords          = np.full(coords.shape, np.nan)
         outcoords[voxmask] = disps
 
-        return outcoords
+        return outcoords.reshape(outshape)
 
 
 class CoefficientField(NonLinearTransform):
-- 
GitLab