diff --git a/fsl/wrappers/wrapperutils.py b/fsl/wrappers/wrapperutils.py
index aab71b90c0afe6ef0e0b369f0d6f830b3be3f511..8a5fa0eb424230684c2af013aed8f0479384cb11 100644
--- a/fsl/wrappers/wrapperutils.py
+++ b/fsl/wrappers/wrapperutils.py
@@ -1050,6 +1050,12 @@ def fileOrImage(*args, **kwargs):
                 hd, infile = tempfile.mkstemp(fslimage.defaultExt(),
                                               dir=workdir)
                 os.close(hd)
+
+                # Create a copy of the input image and
+                # save that, so the original doesn't
+                # get associated with the temp file
+                val = nib.nifti1.Nifti1Image(
+                    np.asanyarray(val.dataobj), None, val.header)
                 val.to_filename(infile)
 
         return infile