问题描述
我正在尝试使用 PyCharm 在 python 中使用 SimpleITK 加载 .nii.gz 文件.理想情况下,ITK 有一个 NIFTI 类,我遵循了这些 教程,所以我认为 SimpleITK 有一个 NIFTI 类的包装器ITK.问题是我得到一个奇怪的退出代码,它没有像这样的文档(根据谷歌)
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
进程已完成,退出代码为 -1073741819 (0xC0000005)
代码很简单:
import numpy as np
import SimpleITK as sitk
image = sitk.ReadImage(filename)
imageSize = image.GetSize()
我也尝试使用 nibabel 库来加载相同的图像格式,但我总是遇到 MemoryError,即使 TaskManager(不是最好的方法)说我有足够的内存.
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.
文件大小约为 123 Mb.任何帮助将不胜感激!
The file is ~123 Mb. Any help would be appreciated!
推荐答案
所以对于任何可能遇到这个问题的人来说,这是 python 版本的问题.我在 64 位 Windows PC 上使用 32 位 Python,当我将其更改为 64 位 Python 并安装了轮子文件 这里,奇怪的退出代码不见了.我还建议关注这个.
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.
这篇关于在 python 中使用 SimpleITK 加载 Nifti 时未处理的退出代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!