Hi, this is my first time. I have a question about the nipype package. I am following a tutorial on its side and keep getting the following error.
TraitError: The ‘in_file’ trait of a BETInputSpec instance must be a pathlike object or string representing an existing file, but a value of ‘/data/ds000114/sub-01/ses-test/anat/sub-01_ses-test_T1w.nii.gz’ <class ‘str’> was specified.
Any idea what can be done.
I have performed the following steps:
from os.path import abspath
from nipype import Workflow, Node, MapNode, Function
from nipype.interfaces.fsl import BET, IsotropicSmooth, ApplyMask
from nilearn.plotting import plot_anat
import matplotlib.pyplot as plt
input_file = abspath("/data/ds000114/sub-01/ses-test/anat/sub-01_ses-test_T1w.nii.gz")
I get the error after the following code.
bet = BET()
bet.inputs.in_file = input_file
bet.inputs.out_file = “/output/T1w_nipype_bet.nii.gz”
res = bet.run()
Hello Abdul and others,
I ran into the same error as well. Have you found a solution, Abdul?
I am running the tutorial as a docker container using the corresponding docker image provided in the docker hub.
I feel like the problem is related to file access permissions. I tried the other notebooks and noticed it has trouble finding files in the /data folder. However, this only happens with the compressed folders (nii.gz)
For example when I try running the notebook, example_preprocessing, I get:
FileNotFoundError: No such file or no access: '/data/ds000114/derivatives/fmriprep/sub-01/anat/sub-01_t1w_preproc.nii.gz'
The file is there, I checked. The notebook can access other file formats, but not these. I thought it could be a permission issue, so I logged in as root and tried it but it still doesn’t work. Furthermore, when I try extracting these folders myself, I ran into an issue:
[Too many levels of symbolic links]
For another notebook (handson_preprocessing) I get the same error as Abdul:
TraitError: The 'in_file' trait of a GunzipInputSpec instance must be a pathlike object or string representing an existing file, but a value of '/data/ds000114/sub-07/ses-test/func/sub-07_ses-test_task-fingerfootlips_bold.nii.gz' <class 'str'> was specified.
Any help or alternative way to run the tutorial is appreciated.