Thanks for the advice. I've tried the following, and maybe I'm just having trouble getting this right conceptually. I've added this @Align_Centers block but it doesn't seem to help.
# --------------------------------
# Align centers of datasets to template
@Align_Centers -base MNI152_T1_2009c+tlrc \
-dset anat_mprage_unif+orig \
-child pb02.$subj.r01.tshift+orig.HEAD \
pb02.$subj.r02.tshift+orig.HEAD \
pb02.$subj.r03.tshift+orig.HEAD \
pb02.$subj.r04.tshift+orig.HEAD \
pb02.$subj.r05.tshift+orig.HEAD \
pb02.$subj.r06.tshift+orig.HEAD \
pb02.$subj.r07.tshift+orig.HEAD \
pb02.$subj.r08.tshift+orig.HEAD \
pb02.$subj.r09.tshift+orig.HEAD \
# --------------------------------
# extract volreg registration base
3dbucket -prefix vr_base pb02.$subj.r01.tshift_shft+orig"[2]"
# ================================= align ==================================
# for e2a: compute anat alignment transformation to EPI registration base
# (new anat will be intermediate, stripped, anat_mprage_ns+orig)
align_epi_anat.py -anat2epi -anat anat_mprage_unif_shft+orig \
-suffix _al_keep \
-epi vr_base+orig -epi_base 0 \
-epi_strip 3dAutomask \
-volreg off -tshift off \
-cost lpc+zz
# ================================== tlrc ==================================
# warp anatomy to standard space
auto_warp.py -base MNI152_T1_2009c+tlrc -input anat_mprage_unif_shft_al_keep+orig \
-skull_strip_input no -unifize_input no
# move results up out of the awpy directory
# (NL-warped anat, affine warp, NL warp)
# (use typical standard space name for anat)
# (wildcard is a cheap way to go after any .gz)
3dbucket -prefix anat_mprage_unif_shft_al_keep \
awpy/anat_mprage_unif_shft_al_keep.aw.nii*
mv awpy/anat.aff.Xat.1D .
mv awpy/anat.aff.qw_WARP.nii .
# ================================= volreg =================================
# align each dset to base volume
foreach run ( $runs )
# register each volume to the base
3dvolreg -verbose -zpad 1 -base vr_base+orig \
-1Dfile dfile.r$run.1D -prefix pb03.$subj.r$run.volreg \
-cubic \
pb02.$subj.r$run.tshift_shft+orig
end
# make a single file of registration params
cat dfile.r*.1D > dfile_rall.1D
# compute motion magnitude time series: the Euclidean norm
# (sqrt(sum squares)) of the motion parameter derivatives
1d_tool.py -infile dfile_rall.1D -set_nruns 9 \
-derivative -collapse_cols euclidean_norm \
-write motion_${subj}_enorm.1D
# create an anat_final dataset, aligned with stats
3dcopy anat_mprage_unif_shft_al_keep+orig anat_final.$subj
# -----------------------------------------
# warp anat follower datasets (non-liner)
3dNwarpApply -source anat_mprage_unif_shft+orig \
-master anat_final.$subj+orig \
-ainterp wsinc5 -nwarp anat.aff.qw_WARP.nii anat.aff.Xat.1D \
anat_mprage_unif_shft_al_keep_mat.aff12.1D \
-prefix anat_w_skull_warped