Using correct SDC / warp file from fmriprep with tedana

Hi guys,

I’m running some multi-echo resting state data through #fmriprep and then #tedana.

I’ve managed to get one participant all the way through as a pilot, but when we look at the transformed tedana output it does not look perfect inferiorly. We’re wondering if we have selected the correct warp file from the fmriprep output.

We used:

Does anyone know if this is the best fmriprep file to use as the warp file for tedana? Or is there a better one?

Thanks, Angharad :slight_smile:

1 Like

Hi Angharad,

The appropriate transform file probably depends on the fMRIPrep version since the working directory is not very stable, but at a glance I think that transform is the field map distortion correction. I don’t think that’s the one you’ll want.

The appropriate transform also depends on the imaging files you’re using. For example, if you grab the images from before distortion correction, you’ll need to grab the distortion correction transform along with any others, whereas if you use the images from after distortion correction, you won’t need that transform.

We recently added a gist (written by @JulioAPeraza) to the tedana documentation (FAQ — tedana 0.0.11rc1+4.ga6b961d.dirty documentation). It selects the echo-wise files after motion correction, slice timing correction, and distortion correction, along with the transform to convert from reference-BOLD space to T1w space. This can be combined with the T1w-to-standard transform, which should already be present in the output directory in newer versions of fMRIPrep.



Thanks so much for the reply @tsalo!

I’m using fmriprep v20.2.0, and the fmriprep run found all files to be BIDS compatible. The code I’m using to collect the fmriprep files is based on the gist you very kindly pointed me to (code from the fantastic @gspitz!).

It’s the first time I’m running fmriprep and tedana. With our code (based on the gist), we’ve grabbed the bold to T1 and native to reference files before distortion correction, and so we’re also trying to grab the right warp file too - we need to specify this from the working directory. We have the echo-wise files after motion correction for the tedana code itself.

Might you be able to recommend the best sdc / warp file for that fmriprep version, or do you need a bit more information than that? Or will it do this automatically if we use your gist?

Thanks so much.

Ah, I see. The fMRIPrep version is compatible with that linked code, but trying to separate out distortion correction makes things more complicated.

I know that @JulioAPeraza wrote a version that grabs the STC+MC files for tedana, along with the SDC warp, which sounds like what you’re trying to do. I am not familiar with that approach, so I think he’s the best person to answer this.

Using that gist directly just bundles distortion correction in with motion correction and slice timing correction, so you only have to apply a transform to T1w space instead of multiple transforms. This is simpler, but also potentially suboptimal (i.e., you’re running tedana on distortion corrected maps).

1 Like

Thanks @tsalo for the helpful comments, and thanks also for pointing us in the direction of @JulioAPeraza.

@JulioAPeraza: Thanks so much in advance :slight_smile: - and please do let me know if you need any more information

Hi Angharad,

To account for the distortion after denoising with tedana, I followed these steps 1: collected echo-wise slice timing corrected data, 2: applied head motion correction, 3: and collected the fieldwarp. Then, I 4: input the motion-corrected images to tedana, and finally 5: applied fieldwarp, scanner2T1w, T1w2MNI to the OC output image.

Steps 1-3 are performed in this script. Just make sure you are collecting the correct warp file (feel free to modify lines 64-69). I only tested this with the pepolar technique (lines 55-60).

Julio A.

1 Like

Thanks so much @JulioAPeraza. That is so helpful.
It’s good to know that we’ve been following the same steps as you, and your code shows the same warp file that we’ve been collecting (lines 64-69)!
We’ll let you know how it all goes!

Best wishes,

Hello again @JulioAPeraza.

Sorry to bother you but I wondered if I could ask another favour?

Looking at this again, if we seem to have the right warp file, I’m wondering we have the right bold to t1 and T1 to MNI files to apply to the OC output image. At the moment, we’ve used:


  • as the t1 to MNI


  • as the bold to T1

I wondered if you had any thoughts as to whether we need to use something different there?

Thanks again for all the help!

Hi @angharaddecates,

Yes, for the version you are running, those look like the right files. If you use FreeSurfer the bold to t1 should be here: bold_reg_wf/bbreg_wf/concat_xfm/out_fwd.tfm

You could also use the transformation saved in the derivatives folder:
scanner2T1w = path/to/fmriprep/sub-<...>/func/sub-<...>_from-scanner_to-T1w_mode-image_xfm.txt
T1w2MNI = path/to/fmriprep/sub-<...>/anat/sub-<...>_from-T1w_to-MNI152NLin6Asym_mode-image_xfm.h5

Julio A.

1 Like

Thanks @JulioAPeraza :smiley: