nipype icon indicating copy to clipboard operation
nipype copied to clipboard

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

Open stepantikhomirov opened this issue 1 year ago • 2 comments

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

stepantikhomirov avatar Nov 29 '23 13:11 stepantikhomirov

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

effigies avatar Nov 29 '23 14:11 effigies

thank you very much, I completely forgot about

stepantikhomirov avatar Nov 29 '23 14:11 stepantikhomirov