Preprocessing with fMRIPrep after Tedana

Hi there,

I’m trying to get my multi-echo data into MNI space after having run it through Tedana. I am doing the preliminary preprocessing in fMRIPrep and using the --me-output-echos function and then having the Tedana outputs go into the derivatives folder of fMRIPrep.

I’m also trying to use the --anat-derivatives function to use the anat files that were preprocessed in the first round of fMRIPrep. When trying to run fMRIPrep again, however, I am getting this error message:

A fieldmap or phase-difference estimation type was found, but an anatomical reference (magnitude file) is missing.

Any ideas what’s going on here? Thanks in advance!

Hi Emily,

  1. What version fMRIPrep are you using? Can you provide an example command with all of the extra arguments?
  2. Is the dataset BIDS valid?
  3. Can you print the output of tree in a subject’s folder in the root directory?
  4. Is this error subject-specific?
  5. Are you reusing work directories?


I am using fMRIPrep version 21.0.1.

The command is as follows: 
fmriprep-docker D:\ED_Pacman\bids\derivatives D:\ED_Pacman\bids\derivatives\tedana participant --participant-label AZ11 --skip_bids_validation --anat-derivatives D:\ED_Pacman\bids\derivatives\sub-AZ11\ --nthreads 16 --omp-nthreads 8 --output-spaces MNI152NLin2009cAsym --fs-license-file D:\ED_Pacman\freesurfer\license.txt -w D:\ED_Pacman\work --fs-no-reconall

the folder structure is as follows:

> sub-AZ11, sub-PY09, etc.
>> anat
>>> [info].nii.gz [Original BIDS data]
>> func
>>> [info].nii.gz [Original BIDS data]
> derivatives
>> sub-AZ11, sub-PY09, etc.
>>> anat
>>> func
>>>> [info]_desc-preproc_bold.nii.gz [outputs from fMRIPrep]
>>>> [info]_desc-optcomDenoised_bold.nii.gz [outputs from Tedana]

I am using the same work directory for fMRIPrep outputs and nothing else. The error is not subject specific; all subjects have the same error.

I hope this helps! Thanks again in advance!

I’m a bit confused:

This suggests that the input BIDS directory is derivatives, which should not be the case. The input directory should be the root BIDS directory, which I imagine for you is bids. Also, is your output folder just derivatives or derivatives\tedana? Based on your folder structure output, it looks like it is just derivatives (which I would consider changing to derivatives\fmriprep in case you process the data in otherways), but your command indicates different.

This, I believe should instead be pointing to that subject’s already-made fMRIPrep anat output folder, which I imagine for you would be D:\ED_Pacman\bids\derivatives\$SUB\anat (unless there is a session folder level but that does not seem to be the case).

Curious where a fieldmap was found! Doesn’t seem like fmaps were collected and you did not use the SYN fieldmapless approach as far as I can tell. Perhaps it was an error that will be fixed by addressing the above points.


Also this order of operations is unclear to me. I don’t think it is right to re-run fMRIPrep on Tedana outputs. Usually it is Raw → fMRIPrep → Tedana, no? Also, if your initial fMRIPrep outputs were in MNI, why would Tedana outputs not be in the same space? Maybe this is just my lack of Tedana knowledge showing, but I don’t see why the output space would change.

Hi Steven,

The data is in native space when it goes through fMRIPrep and when the echoes are output separately using --me-output-echos, each preprocessed echo file comes out in native space as well. I then run them through Tedana for the ME-ICA and optimal combination. The files that come out of Tedana are still in native space and they then need to be transformed into MNI space. My hope was to use the output files of Tedana (optimally combined) as inputs in fMRIPrep such that they can now be converted into MNI space.

I’m somewhat new at this and so I’m not sure if that is precisely what should be occurring, but it is my understanding that this is what others are doing. The only issue is that the process is different when using the --me-output-echos function new to 21.0.1 than when using older version and getting preprocessed files from the work folder. I’m wondering how to get the Tedana images into MNI space using fMRIPrep 21.0.1.

Thanks again!

According to fmriprep’s documentation,

–me-output-echos:Output individual echo time series with slice, motion and susceptibility correction. Useful for further Tedana processing post-fMRIPrep.

This means that the individual echo timeseries will have already been preprocessed, so you would not want to re-preprocess them. As long as MNI outputs were calculated in the first fmriprep run, the Native–>MNI transformations should be available. I imagine you can just apply that transform to tedana outputs.