0

I am trying to load .nii.gz files using SimpleITK in python using PyCharm. Ideally, ITK has a NIFTI class and I followed these tutorials, so I presume SimpleITK has a wrapper for NIFTI class in ITK. The issue is I get a weird exit code which has no documentation (as per google) like this

Process finished with exit code -1073741819 (0xC0000005)

The code is as simple as it gets :

import numpy as np
import SimpleITK as sitk

image = sitk.ReadImage(filename)
imageSize = image.GetSize()

I also tried using nibabel library to load the same image format but I always get a MemoryError, even though, TaskManager (not the best approach) says I have sufficient memory.

The file is ~123 Mb. Any help would be appreciated!

Rick M.
  • 3,045
  • 1
  • 21
  • 39
  • Can you share your file? What other applications are you able to open your file with? Please try slicer3D or ITKsnap. – blowekamp Oct 10 '16 at 14:42
  • Unfortunately, due to research purposes I can't share the file. I can open it with slicer3D and ITKsnap but I want to load it with python for automatic segmentation. It is around ~123 Mb as I said. I also want to point out that I am using python 32 bit on a 64 bit machine. This is because I couldn't load sitk in 64. – Rick M. Oct 11 '16 at 11:35

1 Answers1

0

So to anyone who might land onto this problem, it was an issue with the version of python. I was using 32 bit Python on a 64 bit Windows PC, when I changed it to 64 bit Python and installed the wheels files here, the strange exit code was gone. I would also recommend following this.

Community
  • 1
  • 1
Rick M.
  • 3,045
  • 1
  • 21
  • 39
  • What python wheel were you using before which caused the problem? – blowekamp Oct 11 '16 at 14:54
  • I was using python wheels from the 32 bit from the same website as mentioned in the answer. Now I use everything in 64 bit – Rick M. Oct 12 '16 at 17:15
  • Did you try the official wheels on PyPi? https://pypi.python.org/pypi/SimpleITK/0.9.1 (32-bit) https://pypi.python.org/pypi/SimpleITK/0.10.0 (64-bit only) – blowekamp Oct 12 '16 at 18:43
  • I did, a while back but then I was also trying to get to work with anaconda. I don't understand how this is relevant. – Rick M. Oct 13 '16 at 12:40
  • The source of the problem may be incorrectly compiled binaries SimpleITK wheels (from lfd.uci.edu), or that the binary wheels are incompatible with your Python distribution. – blowekamp Oct 13 '16 at 13:38
  • That is, in this case, the issue. – Rick M. Oct 13 '16 at 14:10