Skip to content

afni/afni

Repository files navigation

What is AFNI?

AFNI (Analysis of Functional NeuroImages) is a suite of programs for looking at and analyzing MRI brain images at all stages of analysis (planning, setting up acquisition, preprocessing, analysis, quality control and statistical analysis). It contains C, Python and R programs, as well as shell scripts, primarily developed for the analysis and display of multiple MRI modalities:

  • functional MRI (FMRI)
    • resting state, task-based or naturalistic paradigms
    • single- or multi-echo acquisitions
  • anatomical/structural MRI
    • at various field strengths
  • diffusion weighted imaging (DWI)
    • for DTI or HARDI modeling and tractography

Many AFNI programs have been applied and adapted to other modalities, such as ECoG, EEG, MEG, and more.

It has graphical displays for both slice-wise and surface-based viewing. In both cases, many aspects of visualization can be scripted for automatic image generation.

Please visit these websites for more information and to ask questions:

Install AFNI on your computer

You can install AFNI on various Linux, macOS and Windows systems. Detailed instructions for each system are provided here. This is the way most users get the AFNI code to use.

Please make sure to use the AFNI system check to help guide you in the process, as well facilitate asking questions:

afni_system_check.py -check_all

Getting started with AFNI: quick guide links

Additional software collaborations

AFNI benefits from integration and collaboration with several other actively developed neuroimaging software packages. We greatly appreciate the work of (and often the discussions with) their developers, and note some of these projects here. Further useful dependencies are cited within the codebase.

The following software are distributed within AFNI directly:

  • dcm2niix, included as dcm2niix_afni
  • NiiVue, included as niivue_afni.umd.js

AFNI also has several programs and features that complement directly with the following projects:

  • FreeSurfer, via @SUMA_Make_Spec_FS and afni_proc.py
  • LayNii, for layer FMRI processing and visualization
  • tedana, via afni_proc.py
  • TORTOISE, via the FATCAT and other DWI tools in AFNI

One aspect of AFNI's wide usage and motivation for maintaining long-term stability is that it serves as an underlying part within several other software projects and pipeline tools in the field. Some projects that use AFNI include:

  • BrainSuite: Functional Pipeline: open-source workflow for processing FMRI data
  • C-PAC: Configurable Pipeline for the Analysis of Connectomes software package
  • DPABI: Data Processing & Analysis for Brain Imaging software suite
  • ENIGMA HALFpipe: software from a consortium combining imaging and genetics
  • fMRIPrep: FMRI preprocessing pipeline that combines tools from well-known software packages
  • LONI QC: data review platform for neuroimaging studies with one or more centers
  • NeoRS: Neonatal Resting State fMRI data preprocessing pipeline
  • NeuroDebian: an open, turnkey platform for neuroscience, integrating software
  • NeuroDesk: open platform of data analysis environments for reproducible neuroimaging
  • Nipype: an open-source initiative to integrate different packages in a workflow

NIFTI and GIFTI

AFNI developers also lead the maintenance of the following fundamental neuroimaging repositories:

These are the code for the standard volumetric and surface dataset formats, respectively, in MRI. These formats are central to how software input/output standard data, and most neuroimaging packages in the field (including AFNI itself) use at least one of these formats.

NIFTI was first developed by a consortium of neuroimaging developers in 2004, with AFNI's Bob Cox being a primary architect and first author of the format description, which is still so widely used today:

AFNI code directory

Currently, the top directory contains three sub-directories, each with further code stratification:

doc/

documentation for AFNI (though this is outdated; current doc content resides in its own git tree here: https://github.com/afni/afni_doc)

src/

source code for AFNI

src/python_scripts/

Python command programs and library files; distributed together as the afnipy module, which can be imported and used as:

from afnipy import ...

tests/

tests for AFNI codebase

Compilation of AFNI

In addition to standard installation of AFNI on computers, you can also compile the code locally on your computer (e.g., for development). In src/, you need to choose one of the Makefile.* files that is closest to your system, and cp it to be named Makefile. Makefile is set up to install into the INSTALLDIR location, defined in that file -- you should probably change that to be appropriate for your use.

If you are using Mac OS X, choose one of the Makefile.macosx* files.

For later versions of Mac OS X, Apple's C compiler does not support OpenMP, so we recommend downloading and installing a version of gcc from http://hpc.sourceforge.net/ or purchasing a commercial C compiler (e.g., Intel's icc) that does support OpenMP. Several important programs in the AFNI suite are parallelized via OpenMP, and will run much faster if compiled appropriately.

If you are using Linux, try Makefile.linux_openmp_64 first.

To make and install everything do:

make vastness

The command:

make cleanest

will remove all the *.o files, etc.

Making a pull request to the AFNI code base

Notes for making a fork and pull request to AFNI are provided here:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/devdocs/pull_requests/pr_ex.html
Users and developers are also welcome to open up GitHub Issues here:
https://github.com/afni/afni/issues
We also have a very active Message Board for asking questions about using AFNI programs, getting help with installations, seeing new features, staying up-to-date with Bootcamp and other announcements, and more:
https://discuss.afni.nimh.nih.gov/

Online testing notes

image

image

image