Alignment troubles

Hello,

I am having great difficulty in aligning the EPI to the anatomical for one of my participants. In original space, they are aligned quite well, but after warping it comes out off. I’ve tried numerous different cost functions to no avail. I’ve attached some screenshots I hope will demonstrate this. These are using the cost function lpc, which thus far seems to result in the best alignment. I’ve also tried using the various “move” functions (‘big_move’ etc.), none of which have helped. There doesn’t seem to be anything unusual about this participant, which is why it is puzzling me. I’ve pasted my processing scripts below. Please let me know if any other information would be helpful. I will take any suggestions you may have.

Thanks,
Kara

@Align_Centers
-cm
-prefix $subj.anat.uni.ac
-dset $scan_dir/$subj.anat.uni+orig
-base TT_N27_SSW.nii.gz

@SSwarper
-input $scan_dir/$subj.anat.uni.ac+orig
-base TT_N27_SSW.nii.gz
-subid $subj
-unifize_off

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+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
-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_align_e2a
-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

Hi, Kara-

You can apply the same shift that got applied to your anatomical (when aligning its center of mass to the template with @Align_Centers) to the EPI, by treating the EPI as a “child” dataset. You would want to copy each of the “-dset …” and “-child …” inputs before running @Align_Centers in this case, because the program will now overwrite each (that is, internally adjust the origin information in the file’s header).

Using your file names, this could be done before running @SSwarper in general with (please read note below before running on your current subj):


3dcopy $scan_dir/$subj.anat.uni+orig $subj.anat.uni.ac
3dcopy EPI EPI_NEW

@Align_Centers \
-cm \
-no_cp \
-dset $subj.anat.uni.ac+orig \
-base TT_N27_SSW.nii.gz
-child EPI_NEW+orig

… and then use EPI_NEW+orig as your afni_proc.py inputs with “-dsets …”.

Note that, in your case here, you have already run @SSwarper; so, in order to not have to run it again, I would do the following:


3dcopy $scan_dir/$subj.anat.uni+orig TEMP_ANAT
3dcopy EPI EPI_NEW

@Align_Centers \
-cm \
-no_cp \
-dset TEMP_ANAT+orig \
-base TT_N27_SSW.nii.gz
-child EPI_NEW+orig

… now, you can ignore TEMP_ANAT-- it just ends up in the exact same pre-aligned-to-template state that your input to @SSwarper did (but it doesn’t overwrite it). Now, you should be able to input EPI_NEW+orig into your afni_proc.py command.

A question though: why does your current input EPI to afni_proc.py command start with pb.00* ? That makes it look like it has already been through some kind of processing with afni_proc.py, which I don’t understand.

–pt

Thanks, I tried this, but unfortunately it turned out almost exactly the same. Thinking it may be another issue? Of note, prior to your helpful response on the other thread about using @Align_Centers, I had processed this participant’s data in MNI space and had similar problems. Apologies, should’ve noted that before.

Regarding the pb00 filename, that’s just one of those things that someone in the lab started over a decade ago and has never been changed for the sake of consistency.

Howdy-

Would you mind uploading the EPI+anat results (unless this is the same one uploaded previously), and I will take a look?

–pt

Sure!