oblique dataset in afni_proc.py example 11

I was able to use afni_proc.py based on example 11 for a resting state analysis on a single subject. After receiving some errors, I added a few steps in the process so that the anatomical image was properly aligned with the epi dataset. This resulted in a properly aligned result (I checked the output with gen_ss_review_Scripts.py). However, I am not sure if these steps are necessary.

  1. Follow instructions for afni_proc under ‘Freesurfer Note’ to align output with input for the T1 anatomical image (using 3dresample and 3dZeropad).
  2. Align the T1 anatomical image to the EPI resting state image (using align_epi_anat.py)
  3. Free surfer is a command line function on this new T1 anatomical image for segmentation
  4. Convert the free surfer output in AFNI
  5. Align centers of the new freesurfer output and EPI image (using @Align_Centers)
  6. run .py scripts in AFNI (afni_proc.py example 11)
  7. Review output with gen_ss_review_Scripts.py

Is it appropriate to use align_epi_anat.py and @Align_Centers? I was unable to pass the data through afni_proc.py without these steps.


If you cannot run afni_proc.py without @Align_Centers,
it suggests that your datasets do not have correct (or
useful) location information in them, e.g. 0,0,0 is at
a corner instead of somewhere near the center of the

Particularly when using FreeSurfer, it would be good
fix this before doing anything else. You might even
investigate why it happened. But to be sure, what is
the output of 3dinfo on the original anat and EPI
datasets (before any processing)?

You need not include the HISTORY.

  • rick

Hi Rick,

Thanks for the response. Before using 3dresample, aligning the anatomical to the EPI, and using Freesurfer the original output of 3dinfo on the anatomical is attached (this is labeled 0101101178_mprage). Also, the unshifted original output of the EPI image for 3dinfo is attached (labeled 0101101178_Run1).


The anatomical output from FRESURFER and the original EPI image appear to align correctly. However, afni_proc terminates with errors if I do not run @Align_Centers. I also used @auto_tlrc in my afni_proc code. Could this be the issue? [url=https://afni.nimh.nih.gov/afni/community/board/read.php?1,149243,149246#msg-149246]

Wow, your anatomical coordinate range is -645 to -390, all on the right
side (to choose one axis). That is pretty messed up. I would highly
suggest running something like:

@Align_Centers -base ~/abin/TT_N27+tlrc -dset XXX.nii.gz

on every XXX.nii.gz dataset for every subject (both mprage and EPI).
That is to say, put them in a common and reasonable location before
running anything else, including FreeSurfer. It is much more work to
try to fix that afterwards, especially if you get surfaces involved.

Basically, the coordinate 0,0,0 should be somewhere towards the
center of a dataset, certainly not far outside it.

  • rick

Thanks! Everything seems to work now.