0

I'm trying to open a zipped nifty file using nibabel library (as nib) and the following code:

img = nib.load (nifti_file)
img_data = img.get_data ()

where nifti_file is a variable with the path to the file in the same directory.

On the second line, there is an out-of-memory error that happens 60% of the time randomly while I try running those two lines. I have enough memory space on my computer so I'm not sure why this happens and also as I mentioned sometimes it simply works.

Dominique
  • 16,450
  • 15
  • 56
  • 112
  • 1
    Make sure you are running the 64-bit version of Python. https://stackoverflow.com/a/1405971/277267 – Daniel F Dec 03 '19 at 11:17
  • Hi, there is a discussion about similar issue here: https://stackoverflow.com/questions/19960166/what-are-the-workaround-options-for-python-out-of-memory-error . I don't think you can do much but catching the exception, free memory and try again as described at https://docs.python.org/3/library/exceptions.html#MemoryError . – carlosvin Dec 03 '19 at 11:18

0 Answers0