在 python 中使用 SimpleITK 加载 Nifti 时未处理的退出代码

Unhandled exit code when loading Nifti with SimpleITK in python

我正在尝试使用 PyCharm 在 python 中使用 SimpleITK 加载 .nii.gz 文件。理想情况下,ITK 有一个 NIFTI class and I followed these tutorials,所以我假设 SimpleITK 在 ITK 中有一个 NIFTI class 的包装器。问题是我得到一个奇怪的退出代码,它没有像这样的文档(根据 google)

进程已完成,退出代码为 -1073741819 (0xC0000005)

代码非常简单:

import numpy as np
import SimpleITK as sitk

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

我也尝试过使用 nibabel 库加载相同的图像格式,但我总是得到一个 MemoryError,尽管 TaskManager(不是最好的方法)说我有足够的内存。

文件约为 123 Mb。如有任何帮助,我们将不胜感激!

所以对于任何可能遇到这个问题的人来说,这是 python 版本的问题。我在 64 位 Windows PC 上使用 32 位 Python,当我将其更改为 64 位 Python 并安装了 wheels 文件 here, the strange exit code was gone. I would also recommend following this.