alignment with lpc+ZZ giant move

hello AFNI,
after I attended your bootcamp this january, I am trying to align some epi using afni_proc.py. The standard version for resting state does not align them properly, so I have tried different modifications with a bit of preprocessing before inserting the data in afni_proc. This is the script I have used:
3dUnifize -prefix 3danat+orig -input anat.nii.gz -GM
3dcopy rest.nii.gz 3drest+orig
3dWarp -deoblique -prefix rest_warp 3drest+orig
3dSkullStrip -input 3danat+orig -prefix 3danat.ns
@Align_Centers -prefix rest_warpAC -dset rest_warp+orig
-base 3danat.ns+orig. -cm

run afni_proc.py

afni_proc.py -subj_id $subj
-script proc.$subj
-scr_overwrite
-blocks despike tshift align tlrc volreg
-copy_anat 3danat.ns+orig
-tcat_remove_first_trs 13
-dsets rest_warpAC+orig
-align_opts_aea -cost lpc+ZZ -giant_move
-anat_has_skull no
-tlrc_opts_at -OK_maxite
-volreg_align_to MIN_OUTLIER
-volreg_align_e2a
-volreg_tlrc_warp
-volreg_interp -Fourier

The best results until now appear to be with giant_move and lpc+ZZ options, but it looks like the original image is shifted and its shape it is changed a lot when compared to the original. The dorsal cortex is great, but the inferior temporal lobes seem to be sort of compressed. Actually, for the inferior brain, the tshifted epi seems to better match the anat… this happens for more than one subject, and is a tendency I have seen in other samples too (that’s why I prefer to use cost such as crU, when it works). With these results, is it ok to go on with the analysis or should I change something in the script?
Until now I have played with options like blur_fwhm 2 in skullstrip, and different costs (crU, lpa, nmi), -big_move or nothing, cmass, -rigid_body, -check_flip in aea

Thanks for any suggestion!
stefano

Sorry, we’re having some problems with our new web server, and your images didn’t appear. The lpc methods are based on locally normalized correlations, so they will produce something a little different than the cru, unnormalized correlation. I suspect there may be some distortions in these datasets that can’t be addressed by an affine method completely. Affine methods apply the same matrix (12 numbers) to every voxel in the dataset, and a kind of majority voting happens with the most voxels weighted by the intensity of the EPI data determines the optimal affine transformation. Nonlinear methods are sometimes used when there are methods to determine the distortion - blipup/down acquisition or B0 fieldmap acquisitions.

Consider adding “-deoblique off” to your list of align_epi_anat.py options. With your separate deobliquing, you won’t need that. Or keep it in and start with your original dataset; align_epi_anat.py should take care of that for you anyway.

If you would like, you can send me some data (our upload capability is down also, so you may use something like DropBox to get it to me).

Ok thanks so much. I’d rather deoblique before afni_proc as it appears necessary for the @align_centers command to succeed (this worked a lot better than the ‘align_center yes’ option in align_epi_anat.py). Unfortunately, even with the ‘-deoblique off’ option nothing changed, if it’s ok I will try to send you a couple of subjects with dropbox: is there a specific email address to send the files to?

The images finally are showing up, but you can still send me some example datasets using Dropbox and the email address found here:

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

I hadn’t looked at the ABIDE data before, but this ABIDE dataset is a little rough in terms of uniformity and structure. I found the obliquity in the datasets isn’t right, so ignoring the information is better. This seemed to do a pretty good job of alignment between the anat and epi datasets you sent:

unifize the anat and epi datasets

3dUnifize -prefix anat_un -GM anat.nii.gz
3dAutomask -apply_prefix rest_am rest.nii.gz
3dUnifize -gm -prefix rest_am_un rest_am+orig.‘[0]’

align_epi_anat.py -cost lpc+ZZ -anat anat_un+orig. -epi rest_am_un+orig.
-epi_strip None -epi_base 0 -deoblique off -giant_move
-suffix _noob_al

Yes ABIDE has lots of problems, but seems to be the only public autism dataset…
I had found similar problems in other ABIDE samples, but this one was particularly tough
thanks so much for all the help!
stefano

hello again,
the modification you suggested changes only to the first epi image, and I am not understanding how to apply it to afni_proc.py. I know that maybe is a stupid question, but could you tell me how would you apply these modifications to afni_proc.py please?
If it is possible I’d rather keep the MIN_OUTLIER option in the volume regulation…

this is my original script
cd /media/stefano/stedamblue/Northoff/ABIDE/IU/IU_proc
foreach subj ( * )

cd $subj
echo $subj

Anat Unifize - Skullstrip

Rest CreateAutomask - Unifize - Deoblique - Center

3dUnifize -prefix 3danat+orig -input anat.nii.gz -GM
3dcopy rest.nii.gz 3drest+orig
3dWarp -deoblique -prefix rest_warp 3drest+orig
3dSkullStrip -input 3danat+orig -prefix 3danat.ns
@Align_Centers -prefix rest_warpAC -dset rest_warp+orig
-base 3danat.ns+orig. -cm

run afni_proc.py

afni_proc.py -subj_id $subj
-script proc.$subj
-scr_overwrite
-blocks despike tshift align tlrc volreg blur mask scale regress
-copy_anat 3danat.ns+orig
-tcat_remove_first_trs 13
-dsets rest_warpAC+orig
-align_opts_aea -cost lpc+ZZ -giant_move -deoblique off -epi_base 0 -epi_strip none
-anat_has_skull no
-tlrc_opts_at -OK_maxite
-volreg_align_to MIN_OUTLIER
-volreg_align_e2a
-volreg_tlrc_warp
-volreg_interp -Fourier
-blur_size 6.0
-mask_apply group
-mask_segment_anat yes
-mask_segment_erode yes
-regress_ROI WMe CSFe
-regress_censor_motion 0.6
-regress_bandpass 0.01 0.2
-regress_apply_mot_types demean deriv
-regress_run_clustsim no

tcsh -xef proc.$subj |& tee output.proc.$subj

thanks for any help, and sorry if come back out of the blue!