Neuroimaging Data Processing/Processing/Tools/AFNI

(Redirected from Neuroimaging Data Processing/AFNI)
Neuroimaging Data Processing/Processing/Tools
FSL AFNI

Structure

edit

AFNI is a command line based tool, i.e. all the processing steps are defined in a script, using commands and methods built-in to afni, which is then run on the data. You can but don't have to put up your scripts from scratch, afni_proc.py and uber-subject.py (see below) are helpful tools to help you putting together your processing script. Afni does have a graphical viewer for images and graphs. Once you have installed AFNI (check tutorial below or [1]) and entered AFNI environment by typing AFNI, you can call this GUI by typing

afni

to you terminal. It will try to find and open Afni or Nifti format datasets in your current folder and otherwise open on a default anatomical image. The tutorial mentioned below gives a good introduction to how you can use the viewer to inspect you data before, during and after processing.

What is afni_proc.py?

edit

a command line program used to generate processing scripts (proc. scripts) for single subject analysis. Generated scripts are in tcsh syntax and written to be easily read and modified. Learn about the syntax you need here [2], where you find a full list of all the possible building blocks and options along with very helpful example scripts. You get the same output when typing (in AFNI environment):

afni_proc.py 

In the AFNI part of the implementation in each subsection of this wikibook there is some very basic information on respective proc.py commands you need for each step. Also the tutorial mentioned below is a good introduction to proc.py. One thing I find helpful to know is how to includ non-default processing blocks in proc.py (if you read the help on proc.py it will become clearer what that means): you can include single blocks in their default position by

-do_block

followed by the name of the block. If you want to include the processing blocks in a specific order use

-blocks

followed by the blocks in their respective order.

What is uber_subject.py?

edit

a graphical user interface to afni_proc.py, for creating processing scripts and running the analysis. When starting with AFNI it might be easiest to create scripts using uber_subject and then explore the generated scripts and modulate them if you wish. However this tool is still rather new and might not be fully developed.

The uber_subject GUI is quite self-explanatory. You can find some help here [3] or just open and explore it using this command (given AFNI is installed and AFNI environment is active)

uber_subject.py
 
Afnis uber_subject.py GUI

Data formats

edit

AFNI can handle nifti files (nii and nii.gz). However, the native data format is .HEAD and .BRIK files (see Afni) and when using nifti files it seems there can be problems with the header information. To import dicom data into head/brik use the to3d command [4].

For example for functional data with TR 2300 ms, 257 volumes, 37 slices acquired in z direction and then in time (zt), in interleaved order (alt+z):

to3d -prefix OUTPUTFILE -time:zt 37 257 2300 alt+z INPUTFILES

INPUTFILES should be all dicoms, i.e. using a wildcard like data/func/run001/*.dcm and for anatomical

to3d -anat -prefix OUTPUTFILE INPUTFILES

Make sure in both cases that INPUTFILES refers to all dicoms, i.e. using a wildcard like path_to_data/*.dcm

Oblique data in AFNI

edit

If you data was acquired oblique this information will be stored in the dicom header. Afni recognizes this and will complain. You should apply 3dWarp[5] to the oblique data (to both anatomical AND functional in case both are oblique). See also [6]

3dWarp -deoblique -prefix OUTPUTFILE INPUTFILE

Otherwise, probably due to different mosaic centers, your coregistration may end up looking something like this:

 
Coregistration can fail with oblique data
edit

Documentation on the single commands http://afni.nimh.nih.gov/pub/dist/doc/program_help//index.html

A tutorial with sample data is provided here: http://afni.nimh.nih.gov/pub/dist/edu/data/CD.expanded/AFNI_data6/FT_analysis/tutorial/

The same tutorial, each step documented in a video: http://andysbrainblog.blogspot.de/2013/08/afni-start-to-finish-playlist.html

This is a really helpful "what you need to know when you are absolutely new to AFNI": http://afni.nimh.nih.gov/pub/dist/doc/program_help/README.afnigui.html

And a ppt presentation which you might also find helpful as a start: http://ngp.usc.edu/files/2013/06/Gimbel_AFNI.pdf

References

edit
  1. http://afni.nimh.nih.gov/pub/dist/HOWTO/howto/ht00_inst/html/
  2. http://afni.nimh.nih.gov/pub/dist/doc/program_help/afni_proc.py.html
  3. http://afni.nimh.nih.gov/pub/dist/doc/program_help/uber_subject.py.html
  4. http://afni.nimh.nih.gov/pub/dist/doc/program_help/to3d.html
  5. http://afni.nimh.nih.gov/pub/dist/doc/program_help/3dWarp.htm
  6. http://afni.nimh.nih.gov/sscc/dglen/Obliquity