Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"TraitError: Each element of the 'in_files' trait of a SmoothInputSpec instance must be a pathlike object or string representing an existing file #3616

Open
stepantikhomirov opened this issue Nov 29, 2023 · 2 comments

Comments

@stepantikhomirov
Copy link

Hello experts,
I've faced this error
"TraitError: Each element of the 'in_files' trait of a SmoothInputSpec instance must be a pathlike object or string representing an existing file, but a value of '/data/Stepan_Tikhomirov/EPIsoDE/rawdata/sub-ZI004/ses-03/func/sub-ZI004_ses-03_task-faces_run-01_bold.nii.gz' <class 'str'> was specified."
when running this code

import nipype.interfaces.spm as spm
smooth = spm.Smooth()
smooth.inputs.in_files = '/data/Stepan_Tikhomirov/EPIsoDE/rawdata/sub-ZI004/ses-03/func/sub-ZI004_ses-03_task-faces_run-01_bold.nii.gz'
smooth.inputs.fwhm = [4, 4, 4]
smooth.run() 

I am sure that this file exists, as I checked it with

from nipype.utils.filemanip import Path
Path('/data/Stepan_Tikhomirov/EPIsoDE/rawdata/sub-ZI004/ses-03/func/sub-ZI004_ses-03_task-faces_run-01_bold.nii.gz').exists()
Out[3]: True

I also used os.exists() and it found this file as well. In addition, I applied different fsl tools (isotropic smooth, for example) to this file and it worked properly. Thus, fsl works, but not spm. What can be the reason?

To give you some more context, Firstly, I activated my environment, then loaded matlab/R2023a, spm12/9.14 and FSL/6.0.6.4. After that I opened spyder from the bash. I can't understand ii it is a nipype problem, compatibility of spm or something else.

Thank you

@effigies
Copy link
Member

Most SPM tools refuse to work with compressed NIfTIs. Have you tried adding a Gunzip node first?

@stepantikhomirov
Copy link
Author

thank you very much, I completely forgot about

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants