AFNI version info (AFNI_26.0.11):
Dear FNI/NHP preprocessing support team,
I am processing macaque resting-state fMRI data with the NMT v2.1 symmetric template. Because the original head position in the scanner was substantially different from the NMT template orientation, I first used SPM to manually adjust the T1-weighted anatomical image, including rotation and origin correction, based on the NMT template orientation. I then applied the same transformation matrix to the fMRI data from the same subject, so that the anatomical and functional images were adjusted consistently.
After this step, I overlaid the T1-weighted anatomical image onto the fMRI image in individual/native space. The anatomical and fMRI images showed good spatial overlap, as shown in Figure 1.
However, when I ran my AFNI preprocessing script:
afni_proc.py \
-subj_id ${subj} \
-blocks tshift align tlrc volreg blur mask scale regress \
-dsets ${dsets_epi} \
-copy_anat ${anat_cp} \
-anat_has_skull no \
-anat_uniform_method none \
-radial_correlate_blocks tcat volreg \
-radial_correlate_opts -sphere_rad 14 \
-tcat_remove_first_trs ${nt_rm} \
-volreg_align_to MIN_OUTLIER \
-volreg_align_e2a \
-volreg_tlrc_warp \
-volreg_warp_dxyz ${final_dxyz} \
-volreg_compute_tsnr yes \
-align_opts_aea -cost "${cost_a2e}" -giant_move \
-cmass cmass -feature_size 0.5 ${aea_extra} \
-align_unifize_epi ${aea_uni_epi} \
-tlrc_base ${ref_base} \
-tlrc_NL_warp \
-tlrc_NL_warped_dsets ${dsets_NL_warp} \
-blur_size ${blur_size} \
-regress_motion_per_run \
-regress_apply_mot_types demean deriv \
-regress_censor_motion ${cen_motion} \
-regress_censor_outliers ${cen_outliers} \
-regress_est_blur_errts \
-regress_est_blur_epits \
-regress_run_clustsim no \
-html_review_style pythonic
the intermediate preprocessed fMRI dataset generated at the pb02 stage no longer aligned well with the subject’s anatomical image in native space. Specifically, when I overlaid pb02.sub-monkey02.r01.volreg onto the individual-space T1 image, the fMRI and T1 images were clearly misaligned, as shown in Figure 2.
After the full preprocessing completed, the AFNI quality-control output, including the generated index.html / PDF QC report and the final alignment images, also indicated poor alignment between the processed fMRI and the anatomical/template space, as shown in Figure 3 and 4.
As a control, I also ran the same preprocessing workflow on a test/sample dataset, and the alignment looked good throughout the preprocessing procedure. Therefore, the current problem seems to be specific to this subject/data rather than a general failure of the preprocessing script.
In summary:
- The SPM-adjusted T1 and fMRI images appear well aligned before AFNI preprocessing.
- The same workflow works well on a test/sample dataset.
- During AFNI preprocessing of my own data, the
pb02fMRI output already appears misaligned relative to the individual-space T1. - The final QC report also shows poor EPI-to-anatomical/template alignment.
I would appreciate your advice on the following questions:
- Could this problem be caused by inconsistent qform/sform information after applying the SPM transformation?
- Does AFNI use the qform or sform preferentially during
afni_proc.py,align_epi_anat.py, andvolreg_tlrc_warp? - Is it appropriate to manually reorient both the anatomical and fMRI data in SPM before AFNI preprocessing, provided that the same transformation matrix is applied to both?
- Should I reset or harmonize the qform/sform information before running
@animal_warperandafni_proc.py? - Is there a recommended workflow for macaque data when the original head orientation differs greatly from the NMT template?
- Since the same workflow works well on the test dataset, what header or spatial metadata differences should I check between the test data and my own data?
I have attached the following materials for reference:
- Figure 1: T1 overlaid on fMRI after SPM-based rotation and origin correction, showing good overlap.
- Figure 2:
pb02fMRI output overlaid on individual-space T1 during AFNI preprocessing, showing misalignment. - Figure 3: final AFNI QC output showing poor alignment.
- Figure 4: The final QC report generated by AFNI preprocessing.
Thank you very much for your time and help. Any suggestions on how to correctly preserve the T1-fMRI spatial relationship and avoid this misalignment during AFNI preprocessing would be greatly appreciated.
Best regards,
Chloe





