批量读取nii文件的shape
作者:互联网
import SimpleITK as sitk from glob import glob import os path = glob(r"D:\MyData\date\*") n = len(path) res = [] for file in path: # print(file) file_name = os.path.join(os.path.join(file, "image"), "sample.nii") im = sitk.ReadImage(file_name) image = sitk.GetArrayFromImage(im) res.append(image.shape[0]) print(image.shape) print(sorted(res))
标签:nii,读取,res,image,shape,sitk,file,path 来源: https://www.cnblogs.com/peixu/p/15937446.html