alignment issue by use afni_proc

AFNI version info (afni -ver): AFNI_24.0.01

Dear AFNI,
I'm using afni to preprocess my resting state data. I tried to run it twice, the first time following example 11, the second time with some deletions, but the QC report shows a poor alignment of epi to anat.

The first scipt:
afni_proc.py                                                           \
      -subj_id                  sub-${subj}                            \
      -dsets                    func/sub-${subj}_use_.nii              \
      -copy_anat                anat/anatSS.${subj}.nii                \
      -blocks                   despike tshift align tlrc volreg blur  \
                                mask scale regress                     \
      -tcat_remove_first_trs    5                                      \
      -anat_has_skull           no                                     \
      -align_opts_aea           -cost lpc+ZZ                           \
                                -giant_move                            \
                                -check_flip                            \
      -tlrc_base                $template                              \
      -tlrc_NL_warp                                                    \
      -tlrc_NL_warped_dsets     anat/anatQQ.${subj}.nii                \
                                anat/anatQQ.${subj}.aff12.1D           \
                                anat/anatQQ.${subj}_WARP.nii           \
      -volreg_align_to          MIN_OUTLIER                            \
      -volreg_align_e2a                                                \
      -volreg_tlrc_warp                                                \
      -blur_size                4                                      \
      -mask_epi_anat            yes                                    \
      -regress_censor_motion    0.2                                    \
      -regress_censor_outliers  0.05                                   \
      -regress_bandpass         0.01 0.1                               \
      -regress_apply_mot_types  deriv                                  \
      -regress_run_clustsim     no                                     \
      -regress_est_blur_epits                                          \
      -regress_est_blur_errts                                          \
      -html_review_style        pythonic


The second script:
afni_proc.py                                                           \
      -subj_id                  sub-001                                \
      -blocks                   despike tshift align tlrc volreg blur  \
                                mask scale regress                     \
      -dsets                    func/sub-001_use_.nii                  \
      -copy_anat                anat/sub-001_T1w.nii                   \
      -anat_has_skull           yes                                     \
      -tcat_remove_first_trs    5                                      \
      -volreg_align_to          MIN_OUTLIER                            \
      -volreg_align_e2a                                                \
      -volreg_tlrc_warp                                                \
      -align_opts_aea           -cost lpc+ZZ                           \
                                -giant_move -check_flip                \
      -tlrc_base                TT_N27+tlrc                            \
      -tlrc_NL_warp                                                    \
      -mask_epi_anat            yes                                    \
      -regress_motion_per_run                                          \
      -blur_size                4                                      \
      -regress_bandpass         0.01 0.1                               \
      -regress_censor_motion    0.2                                    \
      -regress_censor_outliers  0.05                                   \
      -regress_apply_mot_types  deriv                                  \
      -regress_est_blur_detrend yes                                    \
      -regress_run_clustsim no                                         \
      -html_review_style        pythonic                               \
      -execute


The anat to template alignment is fine, but ve2a are showing a bad alignment.
This is the first time I've used afni_proc for preprocessing, is there an error in script?
I am very appreciate that if there have any reply!

Thanks,
Yang

Howdy-

How about adding this option to the first one:

-align_unifize_epi        local  

? This helps overcome EPI brightness inhomogeneity in the EPI-anatomical alignment.

--pt

Hi, ptaylor
Thanks for the quick reply, I added the -align_unifize_epi local option but the results don't seem to be getting any better.



Thanks,
Yang

Hi, Yang-

Hmm, OK. One thing that might be useful is to remove "-giant_move" from your AP command, because your initial EPI-anatomical alignment is actually pretty good. So, you shouldn't need to search a large phase space of matching between the EPI-anatomical.

Another thing is that the EPI tissue contrast is a bit different than we normally see. Normally, the relative brightness pattern of the EPI and anatomical are essentially inverted. That is typical tissue brightness, in decreasing order, is typically:

  • ... EPI: CSF, GM, WM.
  • ... T1w: WM, GM, CSF.
    The lpc (and related lpc+ZZ) cost function is built for dealing with that.

Your EPI tissues don't have such bright CSF, so I wonder if that is part of the issue. You might try changing the cost function to from lpc+ZZ to nmi.

So, those are two potential changes to try.

--pt

Hi, again

Thanks for explaining the properties of the different tissues in EPI and T1w!
The results I got after replacing lpc+ZZ with nmi looked much better! This seems acceptable, is there anything else in the script that could be improved to make the result look a little more perfect?



Thanks,
Yang

Ah, that is great!

Re. other options, I note that we have Codex section of the webpages for Code Examples a recent publication here about QC. There is a link there to github processing scripts for both rest and task that would be useful to check out. There are comments in each code, if you scroll down above the afni_proc.py command to here:, for example.

You can also compare your afni_proc.py command to another one, by adding this option at the bottom of your existing AP command and then copy+pasting all the opts of another below it:

# help description of comparing opts between AP commands

     -compare_opts_vs_opts opts... : compare 2 full commands

        more completely:

            afni_proc.py                            \
                ... one full set of options ...     \
                -compare_opts_vs_opts               \
                ... another full set of options ...

To yours, I might add:

# for more QC
-volreg_compute_tsnr      yes

# for more QC
-radial_correlate_blocks  tcat volreg regress

# and specify what value you want here, in place of the all caps; 
# AP will just slightly upsample by default, rounding slightly,
# but I like to do that for clarity, even if I pick the same value.
-volreg_warp_dxyz         FINAL_DXYZ_SIZE

Also, I would consider not bandpassing to the LFF range, even though I know it is common in the field. A longer discussion of why not to do so---it is very costly in terms of degrees of freedom, and when you have subjects that move, you can over-use all your degrees of freedom, and there iiiis useful information outside that range---is here:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/programs/alpha/afni_proc.py_sphx.html#resting-state-note

--pt

1 Like