I found the EPI and Anat were aligned to different bases in the code generated by defaut proc.py:
[size=small]#The Anat dateset [i]3d_anat+card+orig[/i] was aligned to the first volume of the first run.
#And the forward transforming matrix from EPI to [i]3d_anat+card+orig[/i] was written to file
align_epi_anat.py -anat2epi -anat 3d_anat+card+orig \
-save_skullstrip -suffix _al_junk \
-epi pb02.$subj.r01.despike+orig -epi_base 0 \
-epi_strip 3dAutomask \
-volreg off -tshift off
#[i]3d_anat+card_ns+orig[/i] was aligned to [i]TT_N27+tlrc[/i]. And the inversed transforming matrix was
#stored as the attribute [i]WARP_DATA[/i] in dataset [i]3d_anat+card_ns+tlrc[/i].
@auto_tlrc -base TT_N27+tlrc -input 3d_anat+card_ns+orig -no_ss
#The forward transforming matrix from the first volume of the first run to the other EPI
#volumes was calculated and stored in [i]mat.r$run.vr.aff12.1D[/i].
3dvolreg -verbose -zpad 1 -base pb02.$subj.r01.despike+orig'' \
-1Dfile dfile.r$run.1D -prefix rm.epi.volreg.r$run \
-1Dmatrix_save mat.r$run.vr.aff12.1D \
#The transforming matrix from the first volume of the first run to the other EPI volumes,the
#transforming matrix from [i]3d_anat+card+orig[/i] to EPI and the transforming matrix from
#[i]TT_N27+tlrc[/i] to [i]3d_anat+card_ns+orig[/i] were catenated into a matrix and the matrix
#was stored in [i]mat.r$run.warp.aff12.1D.[/i]
cat_matvec -ONELINE \
3d_anat+card_ns+tlrc::WARP_DATA -I \
3d_anat+card_al_junk_mat.aff12.1D -I \
mat.r$run.vr.aff12.1D > mat.r$run.warp.aff12.1D
#Matrix in [i]mat.r$run.warp.aff12.1D[/i] was used as forward transforming matrix. So the EPI
#volumes were aligned to the first volume of the first run and aligned to [i]3d_anat+card+orig[/i]
#successively before they were aligned to [i]TT_N27+tlrc[/i].
3dAllineate -base 3d_anat+card_ns+tlrc \
-input pb02.$subj.r$run.despike+orig \
-1Dmatrix_apply mat.r$run.warp.aff12.1D \
-mast_dxyz 1 \
3dcalc -a rm.epi.nomask.r$run+tlrc -b mask_epi_extents+tlrc \
-expr 'a*b' -prefix pb03.$subj.r$run.volreg
#[i]pb03.$subj.r$run.volreg[/i] was used to calculate final functional dataset later.[/size]
In summary, Anat was aligned to the first volume of the first EPI run and EPI was aligned to [i]3d_anat+card+orig[/i] before they were aligned to [i]TT_N27+tlrc[/i]. Obviously, [i]3d_anat+card+orig[/i] and the first volume of the first EPI run are not aligned.
The distinct bases make me very confused and I know there must be something wrong with my way of thinking. Could you correct my wrong thinking?
In summary, Anat was aligned to the first volume of the first EPI run and EPI was aligned to 3d_anat+card+orig before they were aligned to TT_N27+tlrc. Obviously, 3d_anat+card+orig and the first volume of the first EPI run are not aligned.
Your “Obviously” statement seems a bit odd. It is indeed
3d_anat+card+orig that is aligned with the EPI in the
align_epi_anat.py step. Specifically, the transformation
between them is noted in that step, and later applied to
the EPI (EPI → volreg → anat → standard space), as
computed by cat_matvec and applied by 3dAllineate.
The anat (_ns) merely goes through a transformation to
standard space via @auto_tlrc.
But they should all be aligned at the end.
Does that seem reasonable?
I am sorry for the careless comment given by myself in the align_epi_anat.py step firstly. What I really want to mean is that the aim of this step is to align the original anat (3d_anat+card+orig) to the EPI. And the aligned result is saved in dataset 3d_anat+card_ns+orig and the forward transforming matrix from EPI to 3d_anat+card+orig was written to file 3d_anat+card_al_junk_mat.aff12.1D.
However, this step don’t change the original anat inputted (3d_anat+card+orig). That is, 3d_anat+card_ns+orig is aligned with the EPI (the first functional volume ) but not 3d_anat+card+orig. If this step changed 3d_anat+card+orig (I don’t think this can happen), it would not change the forward transforming matrix. The inverse of the matrix (transforming matrix from the original anat [size=small][size=x-small]i.e. 3d_anat+card+orig[/size][/size] to EPI) in 3d_anat+card_al_junk_mat.aff12.1 is applied to EPI later. So the final version EPI is aligned to original anat (3d_anat+card+orig) before it is aligned to TT_N27+tlrc later. But the final version anat [size=x-small]i.e.3d_anat+card_ns+tlrc[/size] is aligned with the first functional volume before.
EPI_OtherVolume [u][size=x-small]align[/size][/u] EPI_run1_volume1 [u][size=x-small]align[/size][/u] 3d_anat+card+orig
[u][size=x-small]align[/size][/u] TT_N27+tlrc —> the final version EPI
3d_anat+card+orig [u][size=x-small]align[/size][/u] EPI_run1_volume1 —> 3d_anat+card[b]_ns[/b]+orig
[i]3d_anat+card[b]_ns[/b]+orig[/i] [u][size=x-small]align[/size][/u] TT_N27+tlrc —> 3d_anat+card[b]_ns[/b]+tlrc[/size]
I don’t know whether I express my meaning clearly now.
Thank you Rick!
I think you are just missing a small point. The _ns version
of the anat is not actually transformed from the original, it
is just a skull-stripped version. That version is passed to
@auto_tlrc rather than the orig, so that skull-stripping does
not need to be done twice.
Note that the anatomy that is output by align_epi_anat.py is
called something with _junk, because it is never used again.
That step is only used to get the transformation, since you
requested to align the EPI to the anat, rather than the anat
to the EPI. So the anat->EPI dataset is considered junk.
Does that seem reasonable?
I just edited my last reply to make the meaning clearly. So you mean that the matrix in 3d_anat+card_al_junk_mat.aff12.1D is the forward transforming matrix from EPI to the file called something with _junk rather than 3d_anat+card+orig? The anat->EPI dataset is considered junk. So the skull-stripped version anat 3d_anat+card_ns+orig is not aligned with EPI (the first functional volume )?
If that’s the case, I’ll understand my wrong.
Thank you !
Whether a file contains a forward or reverse direction
transformation actually varies a bit, but yes.
The 3d_anat+card_ns+orig dataset is merely a skull
stripped version of the original, not transformed
at all yet. It is not aligned to the EPI. It is
produced via the -save_skullstrip option was applied
The main point is that 3d_anat+card+orig and
3d_anat+card_ns+orig are in the exact same place.
Also, note the -suffix _al_junk option. So it is
the _al_junk dataset that is actually the output and
transformed one, which we promptly ignore.