Multi-Echo fMRI Analysis Using tedana

This tutorial is a walkthrough of task-based multi-echo fMRI preprocessing using fmriprep, tedana, and afni. There are multiple pipelines available that can be customized to your specific project and which utilize different combination methods. Even if you do not choose to use tedana, their documentation is very thoroughly and provides a strong basis to build your own workflow. Their background on multi-echo methods and general guidelines for preprocessing can be found at this link. A more comprehensive list of resources will be listed at the end of this tutorial.

Background

What is Multi-Echo fMRI?

Researchers interested in multi-echo (ME) fMRI are likely already familiar with standard, single-echo (SE) fMRI sequences. In SE fMRI, one volume is collected at each repetition time (TR). This is done with an excitation pulse, followed by one readout of the data at the echo time (TE). Choosing an echo time depends on what tissue type and brain region you are interested in- typically it is chosen to maximize bold contrast across the brain (the average T2* of brain). Since you are measuring one readout for every TR, the resulting dataset is a complete time series for every voxel as depicted below.

A typical time series for one voxel, as seen in the afni viewer. This time series is taken from the occipital lobe of a brain scanned using a standard single echo EPI fMRI sequence. The vertical y axis is the raw signal of the voxel and the horizontal x axis is time.

ME fMRI is similar to SE fMRI in that there is only one initial excitation pulse. However, immediately following that pulse, multiple readouts are acquired at various chosen echo times. The subsequent "echos" come at the cost of an increased TR, but with the integration of acceleration methods like GRAPPA and multiband, little TR sacrifice (if any) is necessary. The number of echos typically ranges from 3-5, but it is possible to acquire more. The upper limit to the number of echos is when the signal fully decays, requiring another excitation pulse.

Typically, the first echo is acquired immediately following the excitation pulse, followed by a second echo at what would be the typical TE (~40-60ms), and then all remaining echos.

The result of ME fMRI is multiple complete time series per voxel (one for each echo). These separate time series can be combined using various methods.

Time series of one voxel, across the three echos acquired (single-subject ME fMRI data collected at Brown University's MRF).

Why collect multiple echos?

Single-subject ME fMRI data collected at Brown University's MRF. This scan collected three echos, viewed from left to right: TE=12.2, 30.66, and 49.10. This data is presented prior to any preprocessing.

As TE increases, signal decays. Typically, in SE fMRI, researchers select a TE that maximizes the BOLD contrast across the brain. This is not perfect, due to variations in susceptibility across different tissue types, blood, CSF, and the sinuses. Choosing a TE that maximizes BOLD contrast across the brain often results in signal dropout in regions near air/sinuses. For example, you can see below that the signal in the temporal lobe decays at a faster rate than other brain regions. This is due to its close proximity to air in the ear canals.

This view of the brain across multiple echos clearly depicts signal dropout at the tissue border between the temporal lobe and the air in the ear canals. One benefit of combining echos is the recovery of signal in these regions.

Each echo comes with a unique cost/benefit:

  1. EARLY: An echo captured as soon as possible will have low contrast but high SNR

  2. OPTIMAL: the optimal TE (30-60ms) is a "happy medium", with some noise but with the additional bold sensitivity/contrast

  3. LATE: high contrast and low SNR

The aim of ME processing is to take advantage of the benefit of each echo by combining them into one image/time series.

Multi-Echo fMRI Preprocessing

tedana is not a complete workflow- it requires preprocessing before being used, and it does not run a GLM/regression after it is used. Here, the preprocessing is done using fmriprep. Whatever you choose to use, it is important that it does not combine the echos. When using fmriprep, the “--me-output-echos” flag will provide individual echos that have been minimally preprocessed and are ready to be handed to tedana. These echos have the following steps applied: slice time corrected, head motion corrected, and susceptibility distortion corrected.

tedana then takes individual echoes and combines them in various ways. It will produce an ‘optimally combined’ dataset, and a dataset that has undergone multi-echo independent component analysis (MEICA). This is referred to as the "denoised" dataset. When feeding the data into a regression, you do not use both the optimally combined and the denoised data, you choose one (unless you are comparing them). In this tutorial, regressions are completed on the denoised data using afni.

General Overview

  1. Pre-tedana Steps (fmriprep):

    1. Motion Correction

    2. Slice timing correction

  2. Echo Combination/ME Denoising (tedana)

  3. Final Preprocessing/Regression (afni)

    1. Distortion correction

    2. Spatial normalization

    3. Smoothing

    4. Rescaling or filtering

    5. Regression Analysis

Step by Step Guide

Install tedana and organize data

  1. Install tedana

    1. For ease of use, you can download tedana to your local bin directory on Oscar

  2. Download your MRI data and save it in a BIDS formatted directory

    1. This can be completed via xnat2bids on oscar (Instructions here)

  3. Prepare behavioral task timing files (If doing task based ME-EPI)

    1. Download your behavioral timing files (e.g. from psychopy) and place them in $bidsroot/sourcedata/sub-xxx/ses-xx/beh

      1. Convert them to BIDS-friendly tsv files located in $bidsroot/sub-xxx/ses-xx/func

      2. If you are doing your regression with afni, they need to be converted to 1D files

        1. These 1D files should be stored in $bidsroot/derivatives/afni/sub-xxx/ses-xx/stimtimes

    2. Example file conversion scripts for both single subject and group analysis can be found in our documentation on task-based fMRI analysis.

Preprocess the individual echos using fmriprep

  1. Launch the script below by following the instructions found here.

    1. It is important that the “--me-output-echos” flag is included

    2. Data can be in any space you want

    3. Input: the BIDS-formatted data per subject

    4. Output: Preprocessed dataset, including individual echos. Output is located in $bidsroot/derivatives/fmriprep

Combine echos using tedana

Tip: When you input data from fmriprep into other programs that mask it, the masking is not always accurate. This issue can be avoided by providing a mask in the tedana command.

A note on multi-run data: tedana does not accept multiple runs of data in one command. Individual tedana commands are used for every run, and the preprocessed runs can then be combined in the regression

Run tedana with basic defaults using this script:

More Information about this command
  • The -d flag is followed by the multi-echo dataset. Only one run can be input per command, but you can include all the separate echos by using a wildcard. For example, the file we used in our testing was: sub-xxx_ses-xx_task-xxx_acq-me_run-01_echo-*_desc-preproc_bold.nii.gz. The files ending in desc-preproc_bold.nii.gz are the individual echos from fmriprep that have been slice time and motion corrected.

  • The -e flag is followed by the three echo times we chose for our ME sequence. You must change this to correspond to your scan. If you are unsure what the TEs are, you can look in the JSON sidecar associated with the ME NIFTIs. It is important to write these TEs in the correct ascending order- they will be used with the data files respectively.

  • While it is not necessary to provide a mask, we chose to in this instance because we observed improper masking in subsequent steps. Specifically, when we input data from fmriprep into other programs that then mask it (tedana, afni), the masking was not accurate. This issue is avoided by providing a mask in the tedana command.

  • The --out-dir output directory will not be created by tedana- ensure it exists before launching this script. I recommend creating a tedana folder within the bids/derivatives directory.

  • If you would like to use a decision tree other than the default (tedana_orig), you can specify one using the --tree flag.

For further detail on all possible tedana flags, please refer to tedana's documentation.

Information on the outputs of tedana can be found on the tedana website. tedana does not have its own GUI- to visually inspect the data, you can open the viewer of your choice (afni, fsleyes, etc).

Left: The middle echo after preprocessing via fmriprep. Right: The same transverse slice of the brain, after multi-echo denoising/ tedana. Notably, there is recovery from dropout in the temporal and frontal lobes.

Run a regression for task data using afni

Tip: The individual echos from fmriprep will always be output in their own native space, regardless of if you specify a different output space. If you want to standardize your data (for example, to compute voxel-wise comparisons across different datasets), I recommend using antsApplyTransforms before running afniproc.

  1. Use antsApplyTransforms to warp all runs into the same space.

    1. This section of code is based on this example provided by the tedana team

    2. In the fmriprep output, there are corresponding transformation files for each space you specify in your fmriprep command. In this guide, we are not warping the data into standard space (MNI, tlrc), but instead warping all ME functional runs to the anatomical dataset. If you are doing group-level analysis in standard space, then change the antsApplyTransforms flags -r and -t to your desired space. The instructions on the tedana site (provided above) do this- please refer to that for more information about warping to standard space.

  2. Run afniproc

    1. Input:

      1. Fmriprepped T1 anatomical scan

      2. Fmriprepped individual echos (after transforming to the same space)

      3. Stimulus timing files (already converted to afni 1D files)

    2. Output: statistical files (from 3dDeconvolve and/or 3dREML)

More information on the antsApplyTransforms command

antsApplyTransforms allows researchers to transform one image/dataset into the same coordinate space as a another (reference) dataset

  • -e: the number of echos in the ME dataset

  • -i: input image; in our case, the denoised dataset from tedana

  • -r: the reference image, which defines the space that the input image will be transformed into. This is automatically output from fmriprep

  • -o: the filename of the output/warped dataset

  • -n: interpolation method

  • -t: the transform file, also output from fmriprep

Helpful Resources

Video: CMN Core Presentation Series: Advantages of multi-echo fMRI, 2019

Posse S. Multi-echo acquisition. Neuroimage. 2012

Poser et al., BOLD contrast sensitivity enhancement and artifact reduction with multiecho EPI: parallel-acquired inhomogeneity-desensitized fMRI. Magn Reson Med. 2006

Kundu et al., Differentiating BOLD and non-BOLD signals in fMRI time series using multi-echo EPI. Neuroimage, 2012

Posse S. Multi-echo acquisition. Neuroimage. 2012

Kundu et al., Multi-echo fMRI: A review of applications in fMRI denoising and analysis of BOLD signals. Neuroimage. 2017

Lynch et al., Rapid Precision Functional Mapping of Individuals Using Multi-Echo fMRI. Cell Rep. 2020

Last updated

Was this helpful?