The 'mean_img' trait of a MCFLIRTOutputSpec cannot be generated

Summary of what happened:

When I tried to run the preprocessing function on the fMRI images in BIDS format, it stuck at generating the mean image for MCFlirt.

Command used:

I followed an excellent Nipype tutorial by https://miykael.github.io/nipype_tutorial/

Version:

Python: 3.10.9
All executions are on jupyter notebook

Relevant log outputs (up to 20 lines):

Traceback:
 	Traceback (most recent call last):
 	  File "/Users/mekolau/.local/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 454, in aggregate_outputs
	    setattr(outputs, key, val)
 	  File "/Users/mekolau/.local/lib/python3.10/site-packages/nipype/interfaces/base/traits_extension.py", line 330, in validate
 	    value = super(File, self).validate(objekt, name, value, return_pathlike=True)
 	  File "/Users/mekolau/.local/lib/python3.10/site-packages/nipype/interfaces/base/traits_extension.py", line 135, in validate
 	    self.error(objekt, name, str(value))
 	  File "/Users/mekolau/.local/lib/python3.10/site-packages/traits/base_trait_handler.py", line 74, in error
 	    raise TraitError(
 	traits.trait_errors.TraitError: The 'mean_img' trait of a MCFLIRTOutputSpec instance must be a pathlike object or string representing an existing file, but a value of '/Users/mekolau/fmri/nipype/output/workingdir/preproc/_subject_id_01_task_name_task-p_run-01/mcflirt/sub-01_task-p_run-01_bold_roi_mcf_mean_reg.nii' <class 'str'> was specified.
 
 During handling of the above exception, another exception occurred:
 
 	Traceback (most recent call last):
 	  File "/Users/mekolau/.local/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 401, in run 	    outputs = self.aggregate_outputs(runtime)
 	  File "/Users/mekolau/.local/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 461, in aggregate_outputs
 	    raise FileNotFoundError(msg)
 	FileNotFoundError: No such file or directory '/Users/mekolau/fmri/nipype/output/workingdir/preproc/_subject_id_01_task_name_task-p_run-01/mcflirt/sub-01_task-p_run-01_bold_roi_mcf_mean_reg.nii' for output 'mean_img' of a MCFLIRT interface

I have tried different methods like https://neurostars.org/t/mcflirt-error-when-trying-to-output-the-mean-image/17957
and it still didn’t help.

1 Like