nibabel
nibabel copied to clipboard
How to close image file? can't rewrite image when load it in IPython
When I load one image to my Ipython kernel, it is difficult to cancel the file occupation.
I have tried using image.uncache()
and del imange
, but it did not work, I still can't remove the file or rewrite it.
Likely a memmap issue. Does adding mmap=False to the load work?
Likely a memmap issue. Does adding mmap=False to the load work?
test = nib.load('ststr.nii',mmap=False)
test.uncache()
test.to_filename('ststr.nii')
I just used this codes to test the error, but there is still error:
OSError: [Errno 22] Invalid argument: 'ststr.nii'
It seems like that only I restart the IPython kernel, it will release the file occupation.
So you say "Ipython kernel". Is this Jupyter? Are you able to reproduce the issue outside Jupyter?
After my testing, I ensure that it is just in the Jupyter