Skip to content

AFNI and NIfTI Server for NIMH/NIH/PHS/DHHS/USA/Earth

Sections
Personal tools
You are here: Home » SSCC » dglen's Home » Alignment of EPI data across sessions

Alignment of EPI data across sessions

Document Actions
Various approaches to aligning EPI data across sessions

EPI data acquired over several sessions poses a minor nuisance because the data need to be compared on a common basis. There are a few approaches for handling this problem in the AFNI package:


1.  Simple alignment of EPI data (assumes alignment to anatomical data). Our previous recommendation had been this; align anatomical data from multiple sessions using 3dvolreg and then apply the alignment transformation to EPI data from each session using 3drotate and the transformation stored in the header of each  aligned anatomical dataset.

From the help of 3drotate:

  * These options are intended to be used to align datasets between sessions:
     S1 = SPGR from session 1    E1 = EPI from session 1
     S2 = SPGR from session 2    E2 = EPI from session 2
 3dvolreg -twopass -twodup -base S1+orig -prefix S2reg S2+orig
 3drotate -rotparent S2reg+orig -gridparent E1+orig -prefix E2reg E2+orig
     The result will have E2reg rotated from E2 in the same way that S2reg
     was from S2, and also shifted/padded (as needed) to overlap with E1.

The problem with this technique is the EPI data is not aligned as well as it could be with the anatomical data. Before the LPC method we introduced in 2008, alignment of EPI with anatomical data was unreliable or inaccurate. So this method worked reasonably well, and there was no better alternative at the time. Other limitations of this technique include the requirement of corresponding anatomical acquisitions for each session, each parent anatomical dataset sharing the same grid and roughly the same coverage (as written though 3dSkullStrip can help here), and motion correction must be done to the EPI volume acquired closest in time to that  anatomical dataset.

2.  Alignment of EPI data to a single reference anatomical dataset. Align EPI data from each session together and to a specific anatomical dataset for that subject using the align_epi_anat.py script. In this case, the anatomical dataset acts as a subject-specific template.


anat_s1+orig = anatomical dataset from a particular session (session 1) 

epi_s1_r01+orig = EPI dataset from session 1, run 1

epi_s1_r02+orig = EPI dataset from session 1, run 2

epi_s1_r03+orig = EPI dataset from session 1, run 3

...

epi_s2_r01+orig = EPI dataset from session 1, run 1

epi_s2_r02+orig = EPI dataset from session 1, run 2

epi_s2_r03+orig = EPI dataset from session 1, run 3

...


align_epi_anat.py -epi2anat -anat anat_s1+orig -epi epi_s1_r01+orig -epi_base 0 -suffix _al2anat1 -master_epi BASE -master_epi_dxyz 3  -child_epi epi_s1_r??+orig

align_epi_anat.py -epi2anat -anat anat_s1+orig -epi epi_s2_r01+orig -epi_base 0 -giant_move -master_epi BASE -master_epi_dxyz 3 -suffix _al2anat1 -child_epi epi_s2_r??+orig

align_epi_anat.py -epi2anat -anat anat_s1+orig -epi epi_s3_r01+orig -epi_base 0 -giant_move -master_epi BASE -master_epi_dxyz 3 -suffix _al2anat1 -child_epi epi_s3_r??+orig

...

Note a few things about this short script. First, alignment is always done to a single anatomical dataset (anat_s1+orig). This dataset may be from any of the sessions, or it can be from an aligned mean of all anatomical datasets (See the special case below for only two sessions). Second align_epi_anat.py includes motion correction (along with slice timing correction) and combines the motion correction transformation with the alignment transformation. If either the anatomical data or the EPI data is oblique, that transformation will also be combined. Combining the transformations reduces the smoothing effect of multiple interpolations. The aligned EPI datasets are in alignment both with the other EPI datasets and with the anatomical dataset. Using the default LPC method, the align_epi_anat.py script registers the EPI data with the anatomical dataset for what is usually a very good alignment.

The "-giant_move" option is used on the EPI data from sessions other than the target anatomical dataset to allow for large motion and lack of overlap. The master_epi and master_epi_dxyz specify the space and resolution of the aligned EPI data. The child_epi option specifies datasets to align in similar ways as the parent EPI dataset and to apply motion correction of the child_epi datasets to the parent EPI dataset at the epi_base sub-brick volume.

3. Alignment to a standard template. By aligning data to a standard template, all data from all sessions will be in alignment. Data even across multiple subjects is in alignment. This type of output may make it easier to do group analysis (even preferred if using 3dMEMA). Alignment to a standard template can be accomplished in multiple ways. One way is similar to the method above except that it adds a "Talairach parent", a transformation of the anatomical dataset to a standard template. The Talairach parent can be from an anatomical dataset in the same session or from a an anatomical dataset in a different session. The following script simply adds a Talairach parent to each of the alignment commands in the previous script.

@auto_tlrc -template TT_N27+tlrc -suffix NONE anat_s1+orig

align_epi_anat.py -epi2anat -anat anat_s1+orig -epi epi_s1_r01+orig -epi_base 0 -tlrc_apar anat_s1+tlrc -suffix _al2anat1 -master_epi BASE -master_epi_dxyz 3  -child_epi epi_s1_r??+orig

align_epi_anat.py -epi2anat -anat anat_s1+orig -epi epi_s2_r01+orig -epi_base 0 -tlrc_apar anat_s1+tlrc -giant_move -master_epi BASE -master_epi_dxyz 3 -suffix _al2anat1 -child_epi epi_s2_r??+orig

align_epi_anat.py -epi2anat -anat anat_s1+orig -epi epi_s3_r01+orig -epi_base 0 -tlrc_apar anat_s1+tlrc -giant_move -master_epi BASE -master_epi_dxyz 3 -suffix _al2anat1 -child_epi epi_s3_r??+orig

...

Here there will be two sets of EPI data in the output, one in 'orig' space aligned with the anatomical dataset from session 1 and another set in 'tlrc' space aligned with the TT_N27 template. The Talairach parent must be created with @auto_tlrc (manually transformed datasets are not permitted here).

One alternative is to align each set of EPI datasets to an anatomical dataset in the same session and then to the corresponding Talairached anatomical parent. That could be accomplished with this variation:

@auto_tlrc -template TT_N27+tlrc -suffix NONE anat_s1+orig

@auto_tlrc -template TT_N27+tlrc -suffix NONE anat_s2+orig

@auto_tlrc -template TT_N27+tlrc -suffix NONE anat_s3+orig

...

align_epi_anat.py -epi2anat -anat anat_s1+orig -epi epi_s1_r01+orig -epi_base 0 -tlrc_apar anat_s1+tlrc -suffix _al2anat1 -master_epi BASE -master_epi_dxyz 3  -child_epi epi_s1_r??+orig

align_epi_anat.py -epi2anat -anat anat_s1+orig -epi epi_s2_r01+orig -epi_base 0 -tlrc_apar anat_s2+tlrc -master_epi BASE -master_epi_dxyz 3 -suffix _al2anat2 -child_epi epi_s2_r??+orig

align_epi_anat.py -epi2anat -anat anat_s1+orig -epi epi_s3_r01+orig -epi_base 0 -tlrc_apar anat_s3+tlrc -master_epi BASE -master_epi_dxyz 3 -suffix _al2anat3 -child_epi epi_s3_r??+orig

...

This method does not require a "giant_move" for each session, but requires more "auto_talairaching". One could also transform "functional" result datasets (beta values) to a standard template using the -child_epi option or using @auto_tlrc or adwarp (both in usage mode 2).

There are at least two other possibilities here; the simplest is to align all EPI datasets to a "standard" EPI template (akin to the anatomical template) or to align all EPI datasets to a "standard" anatomical template without going through any intermediate anatomical datasets at all for the subject. Both require copying the templates to the subject directory. The output in both cases will be in the "+tlrc" view. Alignment of EPI to EPI data requires a different cost function (this example uses 'lpa' instead). These alignments can be done using these commands:

# align to standard EPI template

align_epi_anat.py -epi2anat -anat TT_EPI+tlrc -epi epi_s1_r01+orig -epi_base 0 -giant_move -cost lpa -suffix _al2TT_EPI -anat_has_skull no -master_epi BASE -master_epi_dxyz 3  -child_epi epi_s1_r??+orig

... # repeat for each EPI session


# align to standard anatomical template

align_epi_anat.py -epi2anat -anat TT_N27+tlrc -epi epi_s1_r01+orig -epi_base 0 -giant_move -suffix _al2N27 -anat_has_skull no -master_epi BASE -master_epi_dxyz 3  -child_epi epi_s1_r??+orig

It's hard to say which is the "best" method of all these. All will require close examination of the data in the AFNI GUI (usually best done by adding the -AddEdge option to each of the align_epi_anat.py commands). The methods will depend, of course, on the individual datasets that have their own scanner artifacts, longitudinal changes between sessions, stimulus types and timing, desired/required anatomical and spatial precision for localization.

4. Alignment between two sessions without bias to either session.

For the specific case of alignment across two sessions, we have a sample script that will compute a mean anatomical dataset that is in-between the two anatomical datasets acquired in each of the sessions. The anatomical mean is used as the reference dataset. See this link for that script:

http://afni.nimh.nih.gov/sscc/dglen/AlignmentAcrossTwoSessions



Created by Daniel Glen
Last modified 2009-10-20 13:45
 

Powered by Plone

This site conforms to the following standards: