Ok, thanks. Yes the mat file from 1Dmatrix_save does have one row per sub brick. However, I'm not sure how the frame to frame displacement is represented in the mat file created in the next cat_matvec step.
This is the volreg step from afni proc that I adapted for my batch script:
# ================================= volreg =================================
# align each dset to base volume, align to anat, warp to tlrc space
# verify that we have a +tlrc warp dataset
if ( ! -f sub_006_T1+tlrc.HEAD ) then
echo "** missing +tlrc warp dataset: sub_006_T1+tlrc.HEAD"
exit
endif
# create an all-1 dataset to mask the extents of the warp
3dcalc -a pb01.$subj.r01.tshift+orig -expr 1 -prefix rm.epi.all1
# register and warp
foreach run ( $runs )
# register each volume to the base
3dvolreg -verbose -zpad 1 -base pb01.$subj.r01.tshift+orig'[0]' \
-1Dfile dfile.r$run.1D -prefix rm.epi.volreg.r$run \
-cubic \
-1Dmatrix_save mat.r$run.vr.aff12.1D \
pb01.$subj.r$run.tshift+orig
# catenate volreg, epi2anat and tlrc transformations
cat_matvec -ONELINE \
sub_T1+tlrc::WARP_DATA -I \
sub_T1_al_mat.aff12.1D -I \
mat.r$run.vr.aff12.1D > mat.r$run.warp.aff12.1D
# apply catenated xform : volreg, epi2anat and tlrc
3dAllineate -base sub_T1+tlrc \
-input pb01.$subj.r$run.tshift+orig \
-1Dmatrix_apply mat.r$run.warp.aff12.1D \
-mast_dxyz 3 \
-prefix rm.epi.nomask.r$run
# warp the all-1 dataset for extents masking
3dAllineate -base sub_T1+tlrc \
-input rm.epi.all1+orig \
-1Dmatrix_apply mat.r$run.warp.aff12.1D \
-mast_dxyz 3 -final NN -quiet \
-prefix rm.epi.1.r$run
# make an extents intersection mask of this run
3dTstat -min -prefix rm.epi.min.r$run rm.epi.1.r$run+tlrc
end
# make a single file of registration params
cat dfile.r??.1D > dfile.rall.1D
# ----------------------------------------
# create the extents mask: mask_epi_extents+tlrc
# (this is a mask of voxels that have valid data at every TR)
3dMean -datum short -prefix rm.epi.mean rm.epi.min.r*.HEAD
3dcalc -a rm.epi.mean+tlrc -expr 'step(a-0.999)' -prefix mask_epi_extents
# and apply the extents mask to the EPI data
# (delete any time series with missing data)
foreach run ( $runs )
3dcalc -a rm.epi.nomask.r$run+tlrc -b mask_epi_extents+tlrc \
-expr 'a*b' -prefix pb02.$subj.r$run.volreg
end
mat.r$run.vr.aff12.1D created by 3dvolreg has one row for each sub brick. However, the resulting mat file created by cat_matvec (mat.r$run.warp.aff12.1D) is one line. Then, during 3dAllineate I am given the following warning for each sub brick:
*+ WARNING: -1D*_apply 'sub_006.warp.mat.1D': 1 isn't enough rows for source dataset -- last row will repeat
...
...
++ ========== sub-brick #113 ========== [total CPU to here=5.2 s]
*+ WARNING: Re-using final row of -1D*_apply 'sub_006.warp.mat.1D' for sub-brick #113
...
I assume these warnings are due to the one row in mat.r$run.warp.aff12.1D created by cat_matvec. My question is how (or if) the frame to frame displacement is represented during afni_proc's volreg step and if this matters. Previously I have used 3dvolreg and I could check visually and see that each volume was registered to the base. After afni_proc, I check visually and it doesn't look like the everything is registered to the same volume and I'm wondering if this is due to the above warning. Thanks!
EDIT for clarification: regarding the previous paragraph - I have visually check the output from 3dvolreg and it looked like everything was registered to the same volume. However afni_proc makes this file a temp, then the output of the entire volreg stop does not appear to be within run volume registered. Hopefully that helps.
Edited 2 time(s). Last edit at 05/26/2015 04:36PM by dmoracze.