Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有nii.gz每个文件的数据集,1G包括4d张量。我知道有两种阅读它们的方法,如下所示:
nii.gz
1G
4d
img = nib.load('fMRI.nii.gz') imgarr = np.array(img.dataobj)
或者
img = nib.load('fMRI.nii.gz') imgarr = img.get_data()
问题是读取整个张量很昂贵,我只需要一片。还有其他方法吗?
实际上,您不需要将任何主要图像数据加载到内存中。
img = nib.load('fMRI.nii.gz') # get the first 10 slices img.slicer[0:10] #verify selection img.slicer[0:10].shape