prep_afni_surf(1) preprocess FreeSurfer surfaces for AFNI/SUMA


usage: pymvpa2-prep-afni-surf [-h] [-v] [-s SID] [-d SURFDIR] [-a ANATVOL]
[-e EPIVOL] [-x EXPVOL] [-E {yes,no}] -r REFDIR
[-p STEPS] [-l LD] [--overwrite] [--hemi {l,r,l+r}] [-S {yes,no}] [--aea_opts AEA_OPTS] [-I] [-A {yes,no}] [-f {gifti,ascii}] [-T] [-t]

Anatomical preprocessing to align FreeSurfer surfaces with AFNI data.

It provides functionality to:

- convert FreeSurfer surfaces to AFNI/SUMA format (using SUMA_Make_Spec_FS).

- resample surfaces to standard topology (using MapIcosahedron) at various resolutions.

- generate additional surfaces by averaging existing ones.

- coregistration of freesurfer output to AFNI/SUMA anatomical or functional volume (using

- run @AddEdge to visualize coregistration.

- merge left (lh) and right (rh) hemispheres into single files (mh).

- generate various views of left+right inflated surfaces.

- generate SUMA specification files, and see_suma* shell scripts.

This script assumes a processing pipeline with FreeSurfer for surface reconstruction, and AFNI/SUMA for coregistration and visualization. Specifically it is assumed that surfaces have been reconstructed using FreeSurfer's recon-all. More details can be found in the documentation available at

If EPIs from multiple sessions are aligned, this script should use different directories for refdir for each session, otherwise naming conflicts may occur.

This function does not resample or transform any functional data. Instead, surfaces are transformed to be in alignment with ANATVOL or EPIVOL.

For typical usage it requires three arguments: (1) "-e epi_filename" or "-a anat_filename" (2) "-d freesurfer/directory/surf" (3) "-r outputdir"' (*) "-T" [if "epi_filename" / "anat_filename" is in template (MNI/Tal) space"


- Please check alignment visually.

- Nifti (.nii or .nii.gz) files are supported, but AFNI may not be able to read the {S,Q}-form information properly. If functional data was preprocessed with a program other than AFNI, please check alignment visually with another program than AFNI, such as MRIcron.


Copyright 2010-2012 Nikolaas N. Oosterhof <[email protected]>

optional arguments:

-h, --help
show this help message and exit
-v, --version
show program's version number and exit
-s SID, --sid SID
subject id used in @SUMA_Make_Spec_FS
-d SURFDIR, --surfdir SURFDIR
FreeSurfer surf/ directory
-a ANATVOL, --anatvol ANATVOL
Anatomical that is assumed to be in alignment with the EPI data of interest
-e EPIVOL, --epivol EPIVOL
EPI data of interest
-x EXPVOL, --expvol EXPVOL
Experimental volume to which SurfVol is aligned
-E {yes,no}, --isepi {yes,no}
Is the experimental volume an EPI (yes) or anatomical (no)
-r REFDIR, -o REFDIR, --refdir REFDIR
Output directory in which volumes and surfaces are in reference to ANATVOL or EPIVOL
-p STEPS, --steps STEPS
Processing steps separated by "+"-characters. "all" is the default and equivalent to "toafni+mapico+moresurfs +skullstrip+align+makespec+makespecboth+makesurfmasks"
-l LD, --ld LD
MapIcosahedron linear devisions, e.g. 80, or 16+96 (for both 16 or 96). The default is 4+8+16+32+64+128
Overwrite existing files
--hemi {l,r,l+r}
Hemispheres to process ([l+r])
-S {yes,no}, --expvol_ss {yes,no}
Skull strip experimental volume ([yes],no)
--aea_opts AEA_OPTS
Options given to align_epi_anat ([-cmass cmass+xyz -big_move])
-I, --identity
Use identity transformation between SurfVol and anat/epivol (no alignment)
-A {yes,no}, --AddEdge {yes,no}
Run AddEdge on aligned volumes ([yes])
-f {gifti,ascii}, --surfformat {gifti,ascii}
Output format of surfaces: 'ascii' (default - for now) or 'gifti'
-T, --template
Indicate that the experimental volume (suppplied by '-e', '-a', or '-x') is in template space. This will add "-Allineate_opts '-maxrot 10 -maxshf 10 -maxscl 1.5'" to --aea_opts
-t, --notemplate
Indicate that the experimental volume (suppplied by '-e', '-a', or '-x') is not in template space.

This function is *experimental*; using the --overwrite option may remove and/or overwrite existing files.