Hello AFNI gurus,
I have some extremely noisy partial coverage data, thermal noise in this case, which I am playing with. Unfortunately I am noting that motion correction between runs is less than adequate. Within run, I believe 3dVolreg is doing ok, but when I examine the mean image of each volreg dataset, they are very visibly shifted. Motion in general is very low, but deviation from run to run add up to many voxels of displacement over space. I was intrigued by the -post_vr_allin option, however, this suffered a similar fate - trying to align each noisy vr_base_per_run to the overall vr_base failed.
I was able to modify the proc script to fix this run to run deviation. Namely, I reordered some things, and used the means of within run volreg to drive cross run alignment. Specifically: quick volreg (on last run in this case) to derive a mean_vr_base image, run volreg within run, derive mean of volreg, and then 3dAllineate within run mean to vr_base_mean.
For reference, here are the changes to the script:
# extract volreg registration base
3dbucket -prefix vr_base pb00.$subj.r12.tcat+orig"[86]"
# CHANGE: Quick volreg to create a "better" vr_base
3dvolreg -prefix rm.epi.volreg.temp pb00.$subj.r12.tcat+orig
3dTstat -mean -prefix mean_vr_base+orig rm.epi.volreg.temp+orig
# ================================= volreg =================================
# align each dset to base volume, across runs
foreach run ( $runs )
# extract volreg base for this run
3dbucket -prefix vr_base_per_run_r$run pb00.$subj.r$run.tcat+orig'[0]'
# register each volume to the base image
3dvolreg -verbose -zpad 1 -base vr_base_per_run_r$run+orig \
-1Dfile dfile.r$run.1D -prefix rm.epi.volreg.r$run \
-Fourier \
-1Dmatrix_save mat.r$run.vr.aff12.1D \
pb00.$subj.r$run.tcat+orig
# CHANGE: create a mean image of the volreg data, for cross run alignment.
3dTstat -mean -prefix mean_vr_base_per_run_r$run rm.epi.volreg.r$run+orig
# and compute xforms for cross-run allin to vr_base
# CHANGE: reordered, and use the mean for the post VR.
3dAllineate -base mean_vr_base+orig \
-source mean_vr_base_per_run_r$run+orig \
-prefix al_mean_vr_base_per_run_r$run+orig \
-1Dfile vr_xrun_allin_dfile.m12.r$run.1D \
-1Dmatrix_save mat.vr_xrun_allin.r$run.aff12.1D \
-autoweight -source_automask \
-warp shr \
-final wsinc5 \
-interp quintic \
-lpa
# catenate volreg/post_vr_allin xforms
cat_matvec -ONELINE \
mat.vr_xrun_allin.r$run.aff12.1D \
mat.r$run.vr.aff12.1D > mat.r$run.warp.aff12.1D
# apply catenated xform: volreg/post_vr_allin
3dAllineate \
-input pb00.$subj.r$run.tcat+orig \
-1Dmatrix_apply mat.r$run.warp.aff12.1D \
-final wsinc5 \
-prefix pb01.$subj.r$run.volreg
end
and here is part of the original script with post_vr_allin added in is below.
# --------------------------------
# extract volreg registration base
3dbucket -prefix vr_base pb00.$subj.r12.tcat+orig"[86]"
# ================================= volreg =================================
# align each dset to base volume, across runs
foreach run ( $runs )
# extract volreg base for this run
3dbucket -prefix vr_base_per_run_r$run pb00.$subj.r$run.tcat+orig'[0]'
# and compute xforms for cross-run allin to vr_base
3dAllineate -base vr_base+orig \
-source vr_base_per_run_r$run+orig \
-1Dfile vr_xrun_allin_dfile.m12.r$run.1D \
-1Dmatrix_save mat.vr_xrun_allin.r$run.aff12.1D \
-autoweight -source_automask \
-lpa -cubic
# register each volume to the base image
3dvolreg -verbose -zpad 1 -base vr_base_per_run_r$run+orig \
-1Dfile dfile.r$run.1D -prefix rm.epi.volreg.r$run \
-Fourier \
-1Dmatrix_save mat.r$run.vr.aff12.1D \
pb00.$subj.r$run.tcat+orig
# catenate volreg/post_vr_allin xforms
cat_matvec -ONELINE \
mat.vr_xrun_allin.r$run.aff12.1D \
mat.r$run.vr.aff12.1D > mat.r$run.warp.aff12.1D
# apply catenated xform: volreg/post_vr_allin
3dAllineate \
-input pb00.$subj.r$run.tcat+orig \
-1Dmatrix_apply mat.r$run.warp.aff12.1D \
-prefix pb01.$subj.r$run.volreg
end
Perhaps this will prove useful for others, or maybe afni_proc could benefit from something like: - -volreg_pvra_base_index MEAN.