Hello,
I’ve been trying to align some partial volume data and finally succeeded using some manual nudging and the Edge option in align_epi_anat.py. My parameters are:
set epi = vr_base_nudge+orig
set anat = KL001_SurfVol_ns+orig
set cost = lpa
align_epi_anat.py -anat2epi -anat $anat
-anat_has_skull no -suffix _al_junk
-epi $epi -epi_base 0
-partial_coronal -epi_strip 3dAutomask
-edge -deoblique on -cost $cost -overwrite
-volreg off -tshift off
While the alignment worked, now when I attempt to use some modified proc snippets to run volreg, registration fails (code below). When using the Edge method, I noticed that I only get an e2a_only transformation matrix. I assumed that including this in the proc without an inverse flag in the cat_matvec command would do the trick, but clearly there is more at work here. I’m guessing now that I also need to account for the nudge transformation, but want to make sure there isn’t something else that I’m missing. Thanks in advance!
================================= volreg =================================
align each dset to base volume, blip warp, align to anat
(final warp input is same as blip input)
register and warp
foreach run ( $runs )
# register each volume to the base
3dvolreg -verbose -zpad 1 -base vr_base_nudge+orig
-1Dfile dfile.r$run.1D -prefix rm.epi.volreg.r$run
-cubic
-1Dmatrix_save mat.r$run.vr.aff12.1D
pb02.$subj.r$run.blip+orig
# create an all-1 dataset to mask the extents of the warp
3dcalc -overwrite -a pb02.$subj.r$run.blip+orig -expr 1 \
-prefix rm.epi.all1
# catenate blip/volreg/epi2anat xforms
cat_matvec -ONELINE \
KL001_SurfVol_ns_al_e2a_only_mat.aff12.1D \
mat.r$run.vr.aff12.1D > mat.r$run.warp.aff12.1D
if ( $run == 01 || $run == 02 ) then
# apply catenated xform: blip/volreg/epi2anat/NLtlrc
# then apply non-linear standard-space warp
3dNwarpApply -master KL001_SurfVol_ns+orig -dxyz 0.75 \
-source pb01.$subj.r$run.tshift+orig \
-nwarp "mat.r$run.warp.aff12.1D blip_warp_1_For_WARP+orig" \
-prefix rm.epi.nomask.r$run
else if ( $run == 03 || $run == 04 ) then
# apply catenated xform: blip/volreg/epi2anat/NLtlrc
# then apply non-linear standard-space warp
3dNwarpApply -master KL001_SurfVol_ns+orig -dxyz 0.75 \
-source pb01.$subj.r$run.tshift+orig \
-nwarp "mat.r$run.warp.aff12.1D blip_warp_2_For_WARP+orig" \
-prefix rm.epi.nomask.r$run
else if ( $run == 05 || $run == 06 ) then
# apply catenated xform: blip/volreg/epi2anat/NLtlrc
# then apply non-linear standard-space warp
3dNwarpApply -master KL001_SurfVol_ns+orig -dxyz 0.75 \
-source pb01.$subj.r$run.tshift+orig \
-nwarp "mat.r$run.warp.aff12.1D blip_warp_3_For_WARP+orig" \
-prefix rm.epi.nomask.r$run
endif
# warp the all-1 dataset for extents masking
3dAllineate -base KL001_SurfVol_ns+orig \
-input rm.epi.all1+orig \
-1Dmatrix_apply mat.r$run.warp.aff12.1D \
-mast_dxyz 0.75 -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+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 6
-derivative -collapse_cols euclidean_norm
-write motion_${subj}_enorm.1D
----------------------------------------
create the extents mask: mask_epi_extents+orig
(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+orig -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+orig -b mask_epi_extents+orig
-expr ‘a*b’ -prefix pb03.$subj.r$run.volreg
end
warp the volreg base EPI dataset to make a final version
cat_matvec -ONELINE KL001_SurfVol_ns_al_e2a_only_mat.aff12.1D > mat.basewarp.aff12.1D
3dAllineate -base KL001_SurfVol_ns+orig
-input vr_base_nudge+orig
-1Dmatrix_apply mat.basewarp.aff12.1D
-mast_dxyz 0.75
-prefix final_epi_vr_base_nudge
create an anat_final dataset, aligned with stats
3dcopy KL001_SurfVol_ns+orig anat_final.$subj