'ImageFileError when using Brain_Data() of nltools

I'm really new to neuroimaging process and trying to load neuroimaging data by using nltools. So the dataset can be found at: https://gin.g-node.org/ljchang/Localizer I have downloaded it to my local and here is my code to access a .nli.gz file

from nltools.data import Brain_Data
#load data
base_dir = 'D:\study_notes\dartbrain\Localizer\derivatives\\fmriprep'
sub = 'S01'

data = Brain_Data(os.path.join(base_dir, f'sub-{sub}','func', f'sub-{sub}_task-localizer_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz'))

However, the Brain_Data() raise

raise ImageFileError(f'Cannot work out file type of "{filename}"')
nibabel.filebasedimages.ImageFileError: Cannot work out file type of "D:\study_notes\dartbrain\Localizer\derivatives\fmriprep\sub-S01\func\sub-S01_task-localizer_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz"

I'm sure that the path is correct and the file has full control permission. Thank you so much!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source