AFNI version info (afni -ver
): Version AFNI_24.1.02 'Publius Septimius Geta'
Hello!
I have 8 epi runs and a T1 anatomical which I am pre-processing using afni_proc.py (blocks tcat despike align volreg surf blur scale; code below).
I am aligning the epi to the anatomical. The alignment is quite good, but a little bit off around somatosensory/ motor areas, where we are investigating.
I want to apply non-linear warping to improve the warp of epi to anatomical, and I have achieved some improvement in alignment of the vr_base_min_outlier (from afni_proc.py) to our affine aligned anat (from afni_proc.py) with 3dQWarp (as suggested in this post Cannot get good alignment with align_epi_anat.py or 3dAllineate - #6 by ptaylor; code below).
This obviously only warps the single sub-brick in the vr_base_min_outlier. I want non-linear warping for ALL runs of my epi data. Questions:
- Do I calculate the non-linear warp once (on one epi sub-brick, as I have done), and then apply this warp to the rest of the epi data? Or should I be calculating the warp separately for each run? Or something more complicated which calculates the warp over time (all sub-bricks)?
- Can I/ should I concatenate this warp in with my volreg/post_vr_allin/epi2anat xforms so they only get applied once? If so, how? I had a look at how a non-linear warp from a tlrc block is concatenated with the affine alignment in afni_proc.py, but the output files are different as it uses @SSWarper (and I am using 3dQwarp) so I was unsure how to proceed.
- Should I be using @SSWarper for my non-linear alignment of epi to anat instead? And then copying the concatenation process in volreg?
- (maybe should have been question 1) Can you confirm I cannot use afni_proc.py to do this? I believe this is the case? If you can, can you let me know how to implement? I did some reading but got the impression it was not possible.
Thank you so much for your help,
I really didn’t want to get this wrong - it’s quite complicated!
Harriet
3dQwarp code
set anat = ${subj}_acq-UNIDEN_run-1_T1w_SS_al_junk
set epi = vr_base_min_outlier
3dresample \
-master ${epi}+orig \
-input ${anat}+orig \
-prefix ${anat}_resamp
3dQwarp \
-source ${anat}${resamp_suffix}+orig.HEAD \
-base ${epi}+orig \
-prefix ${anat}_3dQ \
-lpc -maxlev 0 -verb \
-iwarp
3dNwarpApply \
-nwarp ${anat}_3dQ_WARPINV+orig \
-source ${epi}+orig \
-prefix ${epi}_3dQ_applied
Volreg code from proc script
# catenate volreg/post_vr_allin/epi2anat xforms
cat_matvec -ONELINE \
${subj}_acq-UNIDEN_run-1_T1w_SS_al_junk_mat.aff12.1D -I \
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/epi2anat
3dAllineate -base ${subj}_acq-UNIDEN_run-1_T1w_SS+orig \
-input pb01.$subj.r$run.despike+orig \
-1Dmatrix_apply mat.r$run.warp.aff12.1D \
-mast_dxyz 0.75 -final wsinc5 \
-prefix rm.epi.nomask.r$run
Needs to become more like this? From this post MNI normalization question with 3dNwarpApply - #6 by philippn
# catenate volreg/epi2anat/tlrc xforms
cat_matvec -ONELINE \
anatQQ.FT.aff12.1D \
anatSS.FT_al_junk_mat.aff12.1D -I \
mat.r$run.vr.aff12.1D > mat.r$run.warp.aff12.1D
# apply catenated xform: volreg/epi2anat/tlrc/NLtlrc
# then apply non-linear standard-space warp
3dNwarpApply -master anatQQ.FT+tlrc -dxyz 2.5 \
-source pb01.$subj.r$run.tshift+orig \
-nwarp "anatQQ.FT_WARP.nii mat.r$run.warp.aff12.1D" \
-prefix rm.epi.nomask.r$run
Other parts from my proc script that also need to be modified as they also pertain to combining/ applying warps????
# warp the all-1 dataset for extents masking
3dAllineate -base ${subj}_acq-UNIDEN_run-1_T1w_SS+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
Continued
# warp the volreg base EPI dataset to make a final version
cat_matvec -ONELINE \
${subj}_acq-UNIDEN_run-1_T1w_SS_al_junk_mat.aff12.1D -I > \
mat.basewarp.aff12.1D
3dAllineate -base ${subj}_acq-UNIDEN_run-1_T1w_SS+orig \
-input vr_base_min_outlier+orig \
-1Dmatrix_apply mat.basewarp.aff12.1D \
-mast_dxyz 0.75 -final wsinc5 \
-prefix final_epi_vr_base_min_outlier