Alignment issue during volreg


I have been having issues with the alignment for some of my data (resting state rsfMRI to T1). It appears that this occurs once every 11 subjects, which is not ideal. A colleague has checked with SPM12 and found no issues on their end. Checking with afni (pb03…volreg file) and QC (attached the files: ve2a.jpg and ve2a_2.jpg for visual), it shows that the problem occurs after tcat and despike, and during the volume registration step.

This is my script: -subj_id Subj_5SS                          \
    -blocks despike tshift align tlrc volreg blur mask regress  \
    -copy_anat /data2/open_data/ADNI/ADNI3///Subj_5SS/*Accel*.nii.gz                    \
    -dsets /data2/open_data/ADNI/ADNI3///Subj_5SS/*MRI_E*.nii.gz                  \
    -tcat_remove_first_trs 2                            \
    -align_opts_aea -cost lpc+ZZ                        \
    -tlrc_base MNI_avg152T1+tlrc                        \
    -tlrc_NL_warp                                       \
    -volreg_align_to MIN_OUTLIER                        \
    -volreg_align_e2a                                   \
    -volreg_tlrc_warp                                   \ 
    -mask_epi_anat yes                                  \
    -volreg_warp_dxyz 3                                 \
    -regress_motion_per_run                             \
    -regress_anaticor_fast                              \
    -regress_censor_motion 0.2                          \
    -regress_censor_outliers 0.05                       \
    -regress_apply_mot_types demean deriv               \
    -regress_est_blur_errts                             \
    -regress_run_clustsim no                            \

I’ve tried changing “-volreg_align_to MIN_OUTLIER” to third or last and deleting “-volreg_align_e2a” (If I recall correctly, this causes afni to align a2e?); it did not make the final outcome any better.

I’ve also tried adding " -volreg_allin_auto_stuff -autoweight -warp shift_rotate " after " -tlrc_NL_warp " when the program recommended I used autoweight.

Below is the @ss_review_basic output of this particular example:

subject ID                : Subj_5SS
AFNI version              : AFNI_19.2.01
AFNI package              : linux_ubuntu_16_64
TR                        : 3.0
TRs removed (per run)     : 2
num stim classes provided : 0
final anatomy dset        : anat_final.Subj_5SS+tlrc.HEAD
final stats dset          : NO_STATS
final errts dset          : errts.Subj_5SS.fanaticor+tlrc.HEAD
final voxel resolution    : 3.000000	3.000000	3.000000

motion limit              : 0.2
num TRs above mot limit   : 33
average motion (per TR)   : 0.145185
average censored motion   : 0.120185
max motion displacement   : 0.659715
max censored displacement : 0.617789
outlier limit             : 0.05
average outlier frac (TR) : 0.0078753
num TRs above out limit   : 10

num runs found            : 1
num TRs per run           : 198
num TRs per run (applied) : 136
num TRs per run (censored): 62
fraction censored per run : 0.313131
TRs total (uncensored)    : 198
TRs total                 : 136
degrees of freedom used   : 17
degrees of freedom left   : 119

TRs censored              : 62
censor fraction           : 0.313131
num regs of interest      : 0

TSNR average              : 237.344
global correlation (GCOR) : 0.0574289
anat/EPI mask Dice coef   : 0.796392
blur estimates (ACF)      : 0.664923 3.90318 12.9759
blur estimates (FWHM)     : 0 0 0

I initially suspected that it may be because these brains have severe cortical atrophy, but only about half of the misaligned data were controls. I also have a couple brains that have slight misalignments (not as severe as the attached photos, but still concerning enough). Any suggestion is greatly appreciated. Thank you.

To be sure, if you look at how well the ANAT_al_junk+orig (for whatever ANAT is) dataset aligns with the vr_base dataset, does it seem reasonable or very off?

Maybe the lpc cost function is not working so well, or maybe the skull stripping is failing.

How does the skull stripped anat look? (the _al_junk should be stripped)

  • rick

I suppose, technically, the skull has been stripped? But most of the brain was stripped along with it (and distorted it somewhat), so it doesn’t align with the epi data at all. I at least confirmed that the vr_base does align the original anat (before junk) pretty well. I’ve attached the _al_junk file and the _al_junk file overlayed with vr_base. I’ve also used “uber_skel” because it looks like it tries out multiple cost functions: lpa, lpc+, lpc+ZZ, ls, and nmi. But the results between each cost function are very similar to one another.



It’s been awhile and I thought I’d update my progress and findings.

I’ve been looking at other scripts and programs and decided to use @SSwarper to perform nonlinear alignment and skullstrip T1 to standard MNI space.

@SSwarper \
	-input $subj_id \
	-base ~/abin/MNI152_2009_template_SSW.nii.gz \
	-subid SSW$subj_id \

I’ve selected 6 brains (2 control, 1 mild cognitive impairment, 3 Alzheimer’s) that failed to align in my first run (similar misalignment/warping in my first post). In the first attached image, you can see that the skull-stripping is not working well on these sets of brains (sometimes it leaves the upper portion of the skull alone, sometimes it decides to consume most of the frontal lobe, sometimes both).

I’ve ran @SSwarper on another control brain (took 1.4 hours to finish) that succeeded in skull-stripping and alignment and ran afni_proc based on example 9b using -anat_has_skull no and -tlrc_NL_warped_dsets. The second image shows the resulting QC, which looks acceptable in my view (of course this is debatable, but I couldn’t find a reference or criteria for an acceptable QC). Unless there are other suggestions on improving the skull-stripping other than -deoblique and -giant_move (I’ve tried those two already), I am going to assume that failed attempts are unsuitable for analysis.

I’d like to note that running @SSwarper on these 6 brains took 28 hours. It’s a small sample size but I’ve noticed that it takes a lot longer on the brains with cortical atrophy (MCI and AD). It could be purely coincidental, since one of the AD brains was stripped successfully. Also, when I used @SSwarper on a subject that successfully aligned in my first run, it took less than an hour.


Sorry for losing your previous message (please feel free to occasionally bump them with a tiny reply).

The anat->template image shows a blurry underlay, which I did not notice in your command. When using non-linear registration, the template should not be blurry (if it is, you might as well use affine registration). But that won’t affect the original skull-stripping problems. @SSwarper should indeed do a better job with that, however it might be hindered by use of the blurry template.

Wait, you didn’t use a blurry template in the @SSwarper command. So specify the @SSwarper template with the -tlrc_base option in, to avoid confusion.

Cortical atrophy could certainly make this more difficult though.

Maybe Paul or Daniel will have suggestions for things you might try to improve this.

  • rick

Hello Rick,

So you’re saying that I should change the -tlrc_base in to match the same template that was used in SSwarper like the following? -subj_id SSwarpedSubject                             \
          -blocks despike tshift align tlrc volreg blur mask         \
                  scale regress                                      \
          -copy_anat anatSS.Subj.nii                                \
          -anat_has_skull no                                         \
	  -dsets *rsfMRI*.nii.gz                                     \
          -tcat_remove_first_trs 4                                   \
          -align_opts_aea -ginormous_move -deoblique on -cost lpc+ZZ \
          -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                \
          -volreg_align_to MIN_OUTLIER                               \
          -volreg_align_e2a                                          \
          -volreg_tlrc_warp                                          \

And if I understand this correctly, I should be using MNI152_2009c+tlrc (or MNI152_2009_template.nii.gz?) for non-linear alignment and avoid using MNI_avg152T1+tlrc unless its for affine registration?

Thank you.

Yes, that’s right.

The -tlrc_base option should match what @SSwarper uses.

Yes, it is preferable not to use a blurry template when using non-linear registration. If you use @SSwarper, which we do suggest, then use a template with “SSW” in the name (they are set up for use with @SSwarper).

  • rick