Commit 15b034d7 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

RF: Make sure that input images don't get associated with temp files

parent bd486254
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment