I noticed some alignment issues with one of my datasets, and I think (though am absolutely unsure) that the issue might be because the bottom-most portion of the cerebellum was cut off in the original acquisition. Aside from that, the original EPI and anatomical datasets line up pretty well, which is why I was surprised to get the misaligned output at the end of preprocessing. Are there any program options that you would suggest to help fix this, if it is possible at all? Thank you!
Howdy-
I think we will need some more details to be able to diagnose+prescribe here…
Could you please let us know:
- alignment command you ran—I am not even sure if we are talking about anatomical-template alignment, EPI-anatomical, or the combination thereof; and if nonlinear alignment between the anatomical and template are involved, what program is being used (3dQwarp, auto_warp.py or the recommended @SSwarper)?
- what is the “issue” with this dataset? Can you please attach an image.
- also, what version of AFNI are you using (“afni -ver”)
thanks,
pt
Yes, of course. Details below:
+@SSwarper followed by afni_proc.py (will paste afni_proc.py command below). The issue is with the EPI to anatomical alignment.
+Image attached.
+20.0.19 (I know it’s slightly older, but I’m using an analysis cluster and this is the newest available.)
In investigating this issue and another one I’m having with a different participant, I can’t figure out at what step the alignment from the anatomical to the EPI is saved. I have an “anatSS.subj_al_keep+orig” dataset that is in good alignment with the EPI in original space, but then the anat_final and the .volreg EPI are not. I’m sure I’m missing something either in my afni_proc.py command or in my understanding of the output, but it seems like the anat_final is coming directly from the anatQQ from @SSwarper without the alignment to the EPI transformation. I’m pasting my afni_proc.py command below so maybe you can let me know if I am missing a step. Thank you!
afni_proc.py -subj_id $subj.$task
-script $subj.$task.data_prep -scr_overwrite
-out_dir $task_dir/imaging_data/subjects/$subj/$scan_dir
-copy_anat $top_dir/anatSS.$subj.nii
-anat_has_skull no
-anat_follower anat_w_skull anat $top_dir/$subj.anat.uni.ac+orig
-dsets pb00.$subj.$task.ac+orig.HEAD
-blocks tcat despike ricor tshift align tlrc volreg blur mask scale regress
-radial_correlate_blocks tcat volreg
-tcat_remove_first_trs 3
-ricor_regs_nfirst 3
-ricor_regs $top_dir/$subj.$task.RVT.1D
-align_opts_aea -check_flip -cmass cmass -align_centers yes -cost $cost
-tlrc_base TT_N27_SSW.nii.gz
-tlrc_NL_warp
-tlrc_NL_warped_dsets $top_dir/anatQQ.$subj.nii
$top_dir/anatQQ.$subj.aff12.1D
$top_dir/anatQQ.{$subj}_WARP.nii
-volreg_align_to MIN_OUTLIER
-volreg_tlrc_warp
-volreg_warp_dxyz 1.75
-mask_epi_anat yes
-blur_size 6
-regress_apply_ricor yes
-regress_stim_times
$stim_dir/listen_p.1D
$stim_dir/count.1D
$stim_dir/respond_p.1D
-regress_stim_labels
listen count respond
-regress_basis ‘BLOCK(40,1)’
-regress_opts_3dD
-local_times
-jobs 8
-regress_apply_mot_types demean deriv
-regress_censor_motion 0.3
-regress_censor_outliers 0.05
-regress_reml_exec
-regress_compute_fitts
-regress_make_ideal_sum sum_ideal.1D
-regress_est_blur_epits
-regress_est_blur_errts
-regress_run_clustsim no
The problem seems to be your EPI to anatomical alignment. It looks like it starts out okay but then goes wrong. Try removing "-cmass cmass -align_centers yes " from the afni_proc.py “-align_opts_aea” line. The alignment may need a different cost function depending on the quality of the EPI data, and you can try “-cost lpa” or “-cost nmi” .
Thanks. I tried with -multi_cost so I could compare different cost functions. Some are better, but none are great, and -nmi and -lpa actually make the anatomical quite distorted (to use a technical term, it looks squished).
Not sure if this is playing a role whatsoever, but I also looked at the @SSwarper output again, and noticed in the posterior portion of the brain it is not very precise-looking (not sure how to describe this, see attached image). I’m wondering if it’s having to do a lot of work to try to make it fit the template since the field of view wasn’t great in the original acquisition, and if this might be affecting alignment to the EPI as well.
Howdy-
@SSwarper makes some QC images automatically—could you please post the two QC*jpg images for this subject? One will show masking, and the other alignment to template.
–pt
The @SSwarper alignment is a different alignment, so I don’t want to confuse the two issues here. For the alignment between EPI and anatomical datasets, you can specify one of the partial coverage options to align_epi_anat.py if you have a very limited field of view.
This is just a guess, but the blurriness in the @SSwarper anatomical to template alignment may come from the regions becoming relatively larger in that part of the brain. It doesn’t look too extreme here, and this may not be a problem.
Thanks - I had forgotten about the partial coverage option. Sadly that didn’t seem to work, even with trying out the different cost function options. The thing that gets me is that it looks decently aligned in original space; it’s only after the Talairach transform gets applied that things seem to go awry. I’ve attached a screenshot of the aligned EPI and anat in original space (the final results look about the same as the screenshot in the earlier post).
Hmm, it may be the anatomical-EPI alignment is fine, but anatomical to template alignment is the problem then. The QC images that Paul requested would be useful here. The QC images from afni_proc.py would also show the alignment potentially better than the sliding curtain display.
Thanks. I’ve attached the two jpegs from SSWarper here. Will post another with screenshots from the afni_proc.py QC output. It seems like these look pretty good, but the EPI to anat (next post) looks not as good (though not horrible - mainly near cerebellum). Thus my befuddlement.
Howdy-
Thanks for showing those images. The anatomical-template alignment looks quite good to me.
It is a bit hard to judge the EPI-anatomical alignment. I guess you are using a somewhat old version of AFNI (from before May, 2020)? The QC HTML now puts the EPI as underlay and anatomical dset as overlay edges, for this reason; it makes it easier to see if internal structures line up well. The modern QC also reports about obliquity.
If it’s OK, I will share a Box drive with you to see the data in vivo.
thanks,
pt