OSError:[Errno 24]使用Nibabel打开的文件过多

问题描述 投票:0回答:1

我有一个python3.6程序,使用nibabel包来分析NIFTI格式的医学图像。

import glob
import nibabel as nib
health = [nib.load(pt) for pt in glob.glob(healthdir+'*.nii')] # len = 200
health_data = [h.get_data() for h in health]

它在最后一行发生了OSError: [Errno 24] Too many open files。我使用下面的代码,发现它发生在最后一个元素中的错误。

health_data = []
for i in range(len(health)):
    try:
        health_data.append(health[i].get_data())
    except:
        print(i) # 199

我试图搜索相关主题,如Nibabel: IOError: [Errno 24] Too many open files:。但是,它没有解决问题。另外,我不想使用ulimit。谢谢!

python image macos operating-system medical
1个回答
0
投票

不熟悉Nibabel但尝试qazxsw poi

with

**没有测试

© www.soinside.com 2019 - 2024. All rights reserved.