diff --git a/fsl/utils/image/resample.py b/fsl/utils/image/resample.py
index 02a946f39186d0fefe7bab8f227b0d8c14f77945..371e87b602c60b777bc6e8587aec32b185f08e1d 100644
--- a/fsl/utils/image/resample.py
+++ b/fsl/utils/image/resample.py
@@ -206,7 +206,7 @@ def resample(image,
 
     # same shape and identity matrix? the
     # image doesn't need to be resampled
-    if np.all(np.isclose(image.shape, newShape)) and \
+    if np.all(np.isclose(data.shape, newShape)) and \
        np.all(np.isclose(matrix, np.eye(len(newShape) + 1))):
         return data, image.voxToWorldMat