quality check

Hello,

I am new to AfNI, and I created a script using uber_subjec.py. I ran this script on 10 samples, and 8 out of 10 showed a similar big mismatch between anatomical and EPI data. After checking the attached QC report, can you suggest how should I change my script? If you have suggestion for other than alignment, that would be great as well! Thanks.

Sungjin

Hi, Sungjin-

OK, I don’t know what your afni_proc.py command actually is – you could post it for advice.

I am guessing that you will need the “-giant_move” or option,because your EPI and anatomical appear to be far apart from each other? I am not certain from the present information. However, adding this to your afni_proc.py command should probably help:


-align_opts_aea -cost lpc+ZZ -giant_move                   \

For your template choice, probably a higher-contrast one would be better-- a different MNI, like the MNI152_2009_template.nii.gz, probably. Actually, looking at the skullstripping there a bit (from the underlay in the stats image), you might want to use “@SSwarper” to perform both skullstripping and nonlinear alignment to the anatomical template. There might be some useful comments on this step, and on processing FMRI data in general, here:
https://www.biorxiv.org/content/10.1101/308643v1.abstract
… and you could check out the code scripts associated with that here:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/codex/main_det_2018_TaylorEtal.html
… focusing mostly on this script: s.nimh_subject_level_01_qwarp.tcsh
but do make sure to read the article there, because it describes why would still change some steps that we had to include there for the purpose of the other group’s comparison.

Finally, for general information, you might be interested in some of the online AFNI Bootcamp videos that are available here:
https://cbmm.mit.edu/afni
and here:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/educational/bootcamp_recordings.html
They cover a lot of topics in processing, and things to look out for.

–pt

Oh, and another thing-- we generally don’t recommend building a script from uber_subject.py; it does not have the full array of options that afni_proc.py does. You might be better off looking at “modern processing examples” in the afni_proc.py help, like example #6 for task?

–pt

And last note here: if you have the Python module “matplotlib” available on your computer, you might find it useful to add this option to your afni_proc.py command to have a slightly fancier/nicer looking HTML QC document:


-html_review_style pythonic

And you might want to update your version of AFNI (with “@update.afni.binaries -d”), because from the format of the QC block titles, I think there should be a more modern version of QC functionality.

–pt

Hello pt,

Thanks for your suggestions. I have a question about using SSwarper. In my original script, I used align_epi_anat.py and @auto_tlrc for skull-stripping and aligning anatomical data to standard space as you can see below.

================================= align ==================================

for e2a: compute anat alignment transformation to EPI registration base

(new anat will be intermediate, stripped, unif.anat_ns+orig)

align_epi_anat.py -anat2epi -anat unif.anat+orig
-save_skullstrip -suffix _al_junk
-epi vr_base_min_outlier+orig -epi_base 5
-epi_strip 3dAutomask
-giant_move
-volreg off -tshift off

================================== tlrc ==================================

warp anatomy to standard space

@auto_tlrc -base MNI152_2009_template.nii.gz -input unif.anat_ns+orig -no_ss

store forward transformation matrix in a text file

cat_matvec unif.anat_ns+tlrc::WARP_DATA -I > warp.anat.Xat.1D

Although I can’t find the source, I kind of remember reading that SSwarper simply combined these two functions. If that is the case, using SSwarper wouldn’t change the results, right?

Sungjin

Hi, Sungjin-

@SSwarper combines the steps of skullstripping and alignment to a template space, but it does so in a different way than @auto_tlrc and 3dSkullstrip, for example.

For one thing, @SSwarper uses nonlinear alignment, whereas @auto_tlrc uses linear affine transformations. The former will get muuuch better sulcal/gyral pattern agreement between a subject’s anatomical and the reference dset of interest, in general. Also, in practice @SSwarper has provided really nice skullstripping, as it oscillates back and forth between aligning the anatomical to a template reference and using that reference template to “punch out” the skull, like a cookie-cutter.

There is some more description of using @SSwarper, and why we recommend it so strongly, here:
https://www.biorxiv.org/content/10.1101/308643v1.abstract

–pt

Hello pt,

As you suggest, I used SSwarper for skulstripping and alignment. I found significant improvement in the alignment of anatomical data to a standard template. However, EPI to ANA alignment is still poor. I also notice that the “Check: statistics vols” no longer shows up on my QC report. Can you provide further advice?

afni_proc.py -subj_id $subj
-script proc.$subj -scr_overwrite
-blocks align tlrc volreg blur mask scale regress
-copy_anat $anat_dir/anatSS.$subj.nii
-anat_has_skull no
-dsets
$epi_dir/dspk.AlcPic1+orig.HEAD
$epi_dir/dspk.AlcPic2+orig.HEAD
$epi_dir/dspk.NeutPic+orig.HEAD
$epi_dir/dspk.PV+orig.HEAD
epi_dir/dspk.Rest+orig.HEAD \ -tcat_remove_first_trs 0 \ -align_opts_aea -giant_move -cost lpc+ZZ \ -volreg_align_to MIN_OUTLIER \ -volreg_align_e2a \ -volreg_tlrc_warp -tlrc_base MNI152_2009_template_SSW.nii.gz \ -tlrc_NL_warp \ -tlrc_NL_warped_dsets \ anatQQ.{subj}.nii
anatQQ.{subj}.aff12.1D \ anatQQ.{subj}_WARP.nii
-blur_size 6.0
-regress_stim_times $stim_dir/Timing_R21.txt
-regress_stim_labels
Timing_R21.txt
-regress_basis ‘GAM’
-regress_censor_motion 1.5
-regress_apply_mot_types demean deriv
-regress_motion_per_run
-regress_opts_3dD
-jobs 4
-GOFORIT 5
-regress_reml_exec
-regress_compute_fitts
-regress_make_ideal_sum sum_ideal.1D
-regress_est_blur_epits
-regress_est_blur_errts

Hi, Sungjin-

I will PM you instructions to upload some data so I can take a look. It isn’t obvious to me why the “vstat” QC block would no longer be around.

As to the alignment, it isn’t perfect, but I’d like to see what the EPI set looks like.

–pt