[Neuroimaging] Neuroimaging Digest, Vol 80, Issue 3
Eric Condamine
eric.condamine at univ-grenoble-alpes.fr
Mon Jan 17 06:19:39 EST 2022
Dear Chris,
This is exactly what I needed (and it gave me the idea to go a little further in reading the signatures in the nibabel documentation ;-))
Thanks a lot.
All the best.
Eric
De: neuroimaging-request at python.org
À: "neuroimaging" <neuroimaging at python.org>
Envoyé: Samedi 15 Janvier 2022 18:00:02
Objet: Neuroimaging Digest, Vol 80, Issue 3
Send Neuroimaging mailing list submissions to
neuroimaging at python.org
To subscribe or unsubscribe via the World Wide Web, visit
https://mail.python.org/mailman/listinfo/neuroimaging
or, via email, send a message with subject or body 'help' to
neuroimaging-request at python.org
You can reach the person managing the list at
neuroimaging-owner at python.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Neuroimaging digest..."
Today's Topics:
1. Re: The process cannot access the file because it is being
used by another process ... (Christopher Markiewicz)
----------------------------------------------------------------------
Message: 1
Date: Fri, 14 Jan 2022 16:10:18 +0000
From: Christopher Markiewicz <markiewicz at stanford.edu>
To: Neuroimaging analysis in Python <neuroimaging at python.org>
Subject: Re: [Neuroimaging] The process cannot access the file because
it is being used by another process ...
Message-ID:
<DM8PR02MB8140B890A1E0BEDC7AC73309A9549 at DM8PR02MB8140.namprd02.prod.outlook.com>
Content-Type: text/plain; charset="us-ascii"
Hi Eric,
You may want to use `mmap=False` when loading to ensure that the data array is loaded into RAM rather than memory mapped. Apart from that, the file handles shouldn't be left open.
Best,
Chris
________________________________________
From: Neuroimaging <neuroimaging-bounces+markiewicz=stanford.edu at python.org> on behalf of Eric Condamine <eric.condamine at univ-grenoble-alpes.fr>
Sent: Friday, January 14, 2022 10:27
To: neuroimaging at python.org
Subject: [Neuroimaging] The process cannot access the file because it is being used by another process ...
Dear all,
I observe a small issue with nibabel only under Windows which unlike macos or linux does not allow to delete a file used by a process.
Minimum procedure to reproduce:
PS C:\Users\econd> python
Python 3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import nibabel as nib
>>> import os, sys
>>> b=nib.as_closest_canonical(nib.load('C:\\Users\\econd\\Desktop\\test\\alej170316-IRMFonct_+perfusion-2016-03-17083444-00<callto:2016-03-17083444-00>-T13DSENSE-T1TFE-000425_000.nii'))
>>> b<nibabel.nifti1.Nifti1Image object at 0x000001D898202580
>>>> os.remove('C:\\Users\\econd\\Desktop\\test\\alej170316-IRMFonct_+perfusion-2016-03-17083444-00<callto:2016-03-17083444-00>-T13DSENSE-T1TFE-000425_000.nii')
Traceback (most recent call last): File "<stdin>", line 1, in <module>PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\econd\\Desktop\\test\\alej170316-IRMFonct_+perfusion-2016-03-17083444-00<callto:2016-03-17083444-00>-T13DSENSE-T1TFE-000425_000.nii'
Without going into details in order to not make you waste time unnecessarily, we need in some codes to have access to the b object (vide supra) and then in some cases to delete the file used in the instanciation of b. Under macos and linux no problem but under windows we have the PermissionError exception. How can we manage to delete the file? (del b is not enough!).
All the best for 2022!
Eric
------------------------------
Subject: Digest Footer
_______________________________________________
Neuroimaging mailing list
Neuroimaging at python.org
https://mail.python.org/mailman/listinfo/neuroimaging
------------------------------
End of Neuroimaging Digest, Vol 80, Issue 3
*******************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/neuroimaging/attachments/20220117/d9f56ef0/attachment.html>
More information about the Neuroimaging
mailing list