Skip to content
Snippets Groups Projects
Commit a6b40f98 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

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

parent 343ec864
No related branches found
No related tags found
No related merge requests found
...@@ -1050,6 +1050,12 @@ def fileOrImage(*args, **kwargs): ...@@ -1050,6 +1050,12 @@ def fileOrImage(*args, **kwargs):
hd, infile = tempfile.mkstemp(fslimage.defaultExt(), hd, infile = tempfile.mkstemp(fslimage.defaultExt(),
dir=workdir) dir=workdir)
os.close(hd) 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) val.to_filename(infile)
return infile return infile
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment