registration and re-sampling in native space

Dear Afni’s experts,

I’m re-posting this message that I think got lost.

I would like to register some EPI to the T1 that was collected in a separate session, keeping the original native resolution (3x3x3). I tried to use align_epi_anat.py but the functional run did not look well registered to the anatomical. I also would like to keep the same FoV size (64 64 50).

The functional data were preprocessed but I did not perform any operation on the T1. Ideally, I would like to keep the T1 as it is since all my ROIs are registered to this anatomical scan.

align_epi_anat.py -giant_move -anat sub3_t1.nii -epi sub3_imagery.nii -epi_base 0 -epi2anat

Thank you!
Francesca

Hi, Francesca-

Sorry, missed that earlier post.

Question 1: is this part of a larger processing stream? If you, you might want to consider using afni_proc.py to take care of this as part of its processing? You can specify many options to control the alignment process, but a lot of “under the hood” scripting work (e.g., of inverting and concatenating alignments) will be taken care of for you.

Question 2: is your anatomical volume already skullstripped? That might help, and you can/should specify in your align_epi_anat_command which case it is.

Question 3: do your EPI and anatomical basically overlay each other to start with if you view them in the AFNI GUI, or are they far apart (translation, rotation, etc.)?

Here is an aea command from an afni_proc.py command. It might have some useful things for your case-- the “-giant_move” in case the centers/rotations strongly differ between the dsets; the “-cost lpc+ZZ”, which is both useful for align dsets of differing contrasts (like T1w and EPI) and some extra stability checks; the “-check_flip” will do some checking to guess if your EPI and T1w volumes might have a left-right shift between them, for example due to bad header information; and you can also specify whether your anatomical volume si skullstripped, via “-anat_has_skull …”:


# ================================= align ==================================      
# for e2a: compute anat alignment transformation to EPI registration base         
# (new anat will be current anatSS.sub-001+orig)                                  
align_epi_anat.py -anat2epi -anat sub3_t1.nii \
       -suffix _al_junk                               \
       -epi sub3_imagery.nii -epi_base 0      \
       -epi_strip 3dAutomask                          \
       -anat_has_skull no                             \
       -giant_move -cost lpc+ZZ -check_flip           \
       -volreg off -tshift off

Note also that we often do the EPI->anatomical alignment as “anatomical->EPI”, as specified here, and then invert the transform to apply later with something like cat_matvec (and note that afni_proc.py would take care of the inversion and application of hte alignment, too). For example, if the output transform were A.aff12.1D, you could generate its inverse Ainv.aff12.1D as here:


cat_matvec -ONELINE  A.aff12.1D -I > Ainv.aff12.1D

and then apply it with the following “SOURCE” keyword for the ‘-master …’ option to keep the same input grid for the output:


3dAllineate \
    -1Dmatrix_apply Ainv.aff12.1D \
    -source sub3_imagery.nii \
    -master SOURCE \
    -prefix epi_in_anat.nii

Note that keeping the SOURCE grid might not be a good thing if your EPI and T1w don’t really overlap in the center of the FOVs to start with.