Output files issue with MCFLIRT (Nipype 1.2.0)

I am trying the nipype tutorials and running into this error:

traits.trait_errors.TraitError: The trait 'mean_img' of a MCFLIRTOutputSpec instance is an existing file name, but the path  '/home/kimsin98/nipype_tutorial/preproc01/mcflirt/sub-01_ses-test_task-fingerfootlips_bold_st_mcf.nii.gz_mean_reg.nii.gz' does not exist.

Running the command mcflirt -in /home/kimsin98/nipype_tutorial/preproc01/slicetimer/sub-01_ses-test_task-fingerfootlips_bold_st.nii.gz -meanvol -out /home/kimsin98/nipype_tutorial/preproc01/mcflirt/sub-01_ses-test_task-fingerfootlips_bold_st_mcf.nii.gz -plots in terminal does not result in error.

EDIT: There is an open issue about this on the github.

@AKSoo - many of the nipype tutorials require a specific environment setup that’s available in the docker container that comes along with it. this error may be related to FSL environment variables. you may want to explicitly set the output_type or ensure that your FSL output type is set to NIFTI_GZ .

@Satra I have the exact same problem as @AKSoo, and there are others with the same issue. I tried your suggestion of explicitly defining output_type and setting the default FSL output type to NIFTI_GZ but the issue persists. The problem seems to be that FSL 6 creates the mean_vol without the additional suffix .nii.gz as @roeysc points out in the link above. I have been trying to find a solution to this problem for months now, and I’m not any closer to resolving it. Do you have any suggestion how I can use FSL 6 and nipype without stumbling on this error?

There seems to be no clear way to resolve this with the current Nipype, but the fix is simple if you are willing to dig in and alter the source code.

This line should be changed to outputs['out_file'], suffix='_mean_reg', cwd=output_dir).

This fix will probably come with some later version.

Thank you very much @AKSoo!

Does anyone know if this issue has been resolved or can they offer any advice on how to locate the appropriate source code for altering. I am still running into this issue in 2021 and I am new to nipype and would like a simple fix, if possible.

Best,

Jennifer