alignment issue

Hi, afni experts
I am using to align some epi and anat data. I used -anat2epi option. After I obtained the transformation file, I warped anat to epi, and also epi to anat. The epi2anat data seems sane, indicating a good alignment. But the anat2epi file looks weird. One issue is that, my epi and anat data were collected in different sessions, and thus they are apart.

I did something as below

do the alignment

! -anat2epi
-anat anat.nii.gz
-anat_has_skull no
-suffix _anat2epi.nii.gz
-epi epi.nii.gz -epi_base 0
-epi_strip 3dAutomask
-volreg off -tshift off -overwrite -giant_move -rigid_body\

convert the xfm

!cat_matvec -ONELINE anat_anat2epi.nii.gz_mat.aff12.1D -I > epi2anat.aff12.1D

warp epi 2 anat

!3dAllineate -base anat.nii.gz
-input epi.nii.gz
-1Dmatrix_apply epi2anat.aff12.1D
-mast_dxyz 2 -overwrite
-prefix epi2anat.nii.gz

warp anat 2 epi

!3dAllineate -base epi.nii.gz
-input anat.nii
-1Dmatrix_apply anat_anat2epi.nii.gz_mat.aff12.1D
-master epi.nii.gz -overwrite
-prefix anat2epi.nii.gz




Are either of those data sets appreciably oblique?

3dinfo -obliquity DSET

You should be able to check your results by overlaying the output file with the “_anat2epi*” suffix on it on the base EPI data set. How does that look if you open those up in AFNI?


Try viewing these in the afni GUI instead. The obliquity is handled differently in the GUI than in some other packages, and that may confusing you. Also consider using the -epi2anat option on to invert and apply the transformation. The rigid_body option is rarely used, so that’s surprising to see here. Usually we try to take care of some distortion with the full affine transformation. The rigid body parameters here limit the alignment to only translation and rotation, and not shearing or scaling. That’s fine if you want it, but just be aware of what it is. These parameters are also not the rigid equivalent transformation parameters computed using the full affine transformation, but extracting only the rigid part of that transformation, perhaps a subtle but important difference.