AFNI Message Board

Dear AFNI users-

We are very pleased to announce that the new AFNI Message Board framework is up! Please join us at:

https://discuss.afni.nimh.nih.gov

Existing user accounts have been migrated, so returning users can login by requesting a password reset. New users can create accounts, as well, through a standard account creation process. Please note that these setup emails might initially go to spam folders (esp. for NIH users!), so please check those locations in the beginning.

The current Message Board discussion threads have been migrated to the new framework. The current Message Board will remain visible, but read-only, for a little while.

Sincerely, AFNI HQ

History of AFNI updates  

|
October 25, 2021 09:40PM
Hi there,

I am trying to align my SurfVol to my experimental anatomy but I just can't get it to fit well enough. This is despite me nudging the SurfVol for a long time and getting it very close to the experimental anatomy.

The imaged I attached is as good as I can get (underlay: experimental anatomical (aligned to epi); overlay: SurfVol (aligned to experimental anatomy))

Background: The experimental anatomy has been aligned to my epi data (7T, partial FOV/ slab). I made my own whole brain anatomy (full field of view) with skull using 3dAllineate as afni_proc.py gives you a skull-free partial FOV anatomical when you align it to partial epi data.

To improve alignment, my colleague suggested to use a SurfVol with the skull on, but I can't see any options in @SUMA_Make_Spec to allow this. Is this possible?

I also saw in this (https://afni.nimh.nih.gov/pub/dist/edu/latest/suma/suma.pdf) that one option if your alignment to experiment fails is to use 3dTagalign but I can't quite work out what options I need.

I was also wondering if I could use 3dAllineate with the transformation matrix I used to align my experimental anatomy with the epi data in some way?

I have pasted my code below. Any help would be very much appreciated.

Note: the -wd flag always makes it much worse, makes SurfVol big and warped

Step 1. Creating whole-brain warped experimental anatomical

## Create full coverage, skull on, warped anatomical
3dZeropad -I 100 -S 100 -A 100 -P 100 -L 50 -R 120 \
-prefix rm.{$raw_anat_name}_wholebrain_padded+orig \
$raw_anat_dir/{$raw_anat_name}{$raw_anat_ext}

# gunzip rm.{$raw_anat_name}_wholebrain_padded+orig.BRIK.gz

3dAllineate -source rm.{$raw_anat_name}_wholebrain_padded+orig \
-final wsinc5 \
-1Dmatrix_apply $mat_dir/$mat_name \
-prefix rm.{$raw_anat_name}_wholebrain_padded_warped+orig

# gunzip rm.{$raw_anat_name}_wholebrain_padded_warped+orig.BRIK.gz

# Remove excess
3dZeropad -I -0 -S -0 -A -180 -P -60 -L -200 -R -0 \
-prefix {$raw_anat_name}_wholebrain_unpad_warped+orig \
rm.{$raw_anat_name}_wholebrain_padded_warped+orig


Step 2. Align SurfVol to experimental anatomy

# Zeropad SurfVol
3dZeropad -I 20 -S 20 -A 20 -P 20 -L 0 -R 100 \
-prefix rm.{$surf_subj_num}_{$subj_init}_SurfVol_padded \
rm.{$surf_subj_num}_{$subj_init}_SurfVol+orig

# Then open it and nudge it towards the location of the anatomical

# Create a nudged surfvol in the experimental folder
3drotate -quintic -clipit -rotate 6.47I 7.64R 35.43A -ashift -3.45S -81.29L -16.76P -prefix rm.{$surf_subj_num}_{$subj_init}_SurfVol_padded_nudged rm.{$surf_subj_num}_{$subj_init}_SurfVol_padded+orig

# Make transformation matrix
cat_matvec 'rm.'{$surf_subj_num}'_'{$subj_init}'_SurfVol_padded_nudged+orig::ROTATE_MATVEC_000000' -I \
> XFORM0.1D

# Use this nudged surfvol to create the surfvol aligned to experiment in next step



# ======================= surf (map data to surface) =======================
# map EPI data to the surface domain

# align the surface anatomy with the current experiment anatomy
@SUMA_AlignToExperiment \
-init_xform XFORM0.1D -align_centers \
-surf_anat rm.{$surf_subj_num}_{$subj_init}_SurfVol_padded+orig \
-exp_anat $exp_anat \
-prefix {$subj}_SurfVol_Alnd_Exp_xform2


Other Step 2 attempts that did not work either

#### wd flag
# @SUMA_AlignToExperiment -exp_anat $exp_anat \
# -surf_anat rm.{$surf_subj_num}_{$subj_init}_SurfVol_padded_nudged2+orig \
# -align_centers \
# -wd -EA_clip_below -80 \
# -atlas_followers -overwrite_resp S \
# -prefix {$subj}_SurfVol_Alnd_Exp_wd_EAclip

#### Basic version
# Removed -align_centres
# @SUMA_AlignToExperiment -exp_anat $exp_anat \
# -surf_anat rm.{$surf_subj_num}_{$subj_init}_SurfVol_unpadded_nudged2+orig \
# -atlas_followers -overwrite_resp S \
# -prefix {$subj}_SurfVol_Alnd_Exp_2_unpad_no_al_centres

#### Old commands generated by afni_proc - don't work
# @SUMA_AlignToExperiment -exp_anat $exp_anat \
# -surf_anat $surface_dir/P0{$surf_subj_num}_{$subj_init}_SurfVol+orig \
# -wd -strip_skull surf_anat \
# -atlas_followers -overwrite_resp S \
# -prefix ${surf_subj_num}_SurfVol_Alnd_Exp
Attachments:
open | download - P19_JD_surf_vol_not_aligned_to_exp_smaller.jpg (270.8 KB)
Subject Author Posted

@SUMA_AlignToExperiment alignment not working well Attachments

hdempseyjones October 25, 2021 09:40PM

Re: @SUMA_AlignToExperiment alignment not working well

hdempseyjones November 22, 2021 11:20PM

Re: @SUMA_AlignToExperiment alignment not working well

rick reynolds November 23, 2021 08:42AM