I’ve been profiling some code, where a processing bottleneck occurs (method 'decompress' of 'zlib.Decompress' objects}
). I believe this is from my nibabel.load
command for loading large resting state nifti files (1.2G; shape=(88, 88, 60, 1130)). Loading one file can take 8-11 seconds, and I’m attempting to load multiple files per subject, across many subjects in a dataset. To save time and memory, I’d like to simply load a single volume, but haven’t been able to do so. My code is as follows:
import nibabel as nib
img_vol = nib.load('rsfMRI.nii.gz').dataobj[..., -1]
I was wondering if there’s a way to speed this loading process in nibabel, or if this is to be expected given the large file sizes?