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:
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
Installing AFNI on your system
Educational resources
Code, command, script and functionality examples
Additional resources
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:
AFNI also has several programs and features that complement directly with the following projects:
- FreeSurfer,
via
@SUMA_Make_Spec_FSandafni_proc.py - LayNii, for layer FMRI processing and visualization
- PsychoPy, via AFNI real-time features
- 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:
- ASLprep: suite of software pipelines for processing of ASL MRI data
- BrainForge: cloud-enabled, web-based analysis platform for neuroimaging
- brainlife.io: an open-source cloud platform to support neuroscience research
- BrainSuite: Functional Pipeline: open-source workflow for processing FMRI data
- C-PAC: Configurable Pipeline for the Analysis of Connectomes software package
- DeepPrep: neuroimaging preprocessing pipeline powered by deep learning algorithms and a workflow manager
- DPABI: Data Processing & Analysis for Brain Imaging software suite
- ENIGMA HALFpipe: software from a consortium combining imaging and genetics
- fMRIflows: FMRI processing pipeline tool, including group-level analyses
- fMRIPrep: FMRI preprocessing pipeline that combines tools from well-known software packages
- FreeSurfer: analysis package for structural and functional neuroimaging data
- FunMaps: a tool for parcellating resting state FMRI networks
- FuNP: FMRI preprocessing pipeline tool combining tools from well-known packages
- LONI QC: data review platform for neuroimaging studies with one or more centers
- LUMEN: a deep-learning pipeline for segmentation and 3D morphological analysis of cerebral lenticulostriate arteries from 7T TOF MRI
- macapype: open-source framework for preparing and processing nonhuman anatomical MRI data
- MEICA4: software for denoising multiecho FMRI with independent component analysis
- Micapipe: a processing pipeline to analyze multimodal MRI data
- MRI-NIRS_Pipeline: a complete pipeline for image reconstruction in fNIRS
- MRIQC: extract image quality metrics from structural, functional and diffusion MRI
- NeoRS: Neonatal Resting State fMRI data preprocessing pipeline
- Neptune: a toolbox for processing spinal cord FMRI
- NeuroDebian: an open, turnkey platform for neuroscience, integrating software
- NeuroDesk: open platform of data analysis environments for reproducible neuroimaging
- NeuroDocker: command-line program that generates custom Dockerfiles and Singularity for reproducible neuroimaging
- niimath: a multipurpose tool, cloning fslmaths and several AFNI programs
- NiiVue and niivue-desktop: a cross-platform medical image viewer and desktop app
- Nipype: an open-source initiative to integrate different packages in a workflow
- PESTICA & SLOMOCO: physio and slice-oriented motion correction tools
- PETprep: preprocessing of positron emission tomography (PET) imaging data
- PETsurfer: a set of tools within FreeSurfer for end-to-end integrated MRI-PET analysis
- PhiPipe: a processing pipeline for resting state FMRI and DWI data
- PyDecNef: framework for real-time fMRI decoded neurofeedback
- QSIPrep: configure pipelines for processing diffusion-weighted MRI (dMRI) data
- QuNex: platform for end-to-end neuroimaging processing and analytics
- RABIES: pipeline for rodent FMRI processing and quality control
- rPOP: PET-only processing of heterogeneous amyloid-PET data
- RTPSpy: Python library for real-time fMRI (rtfMRI) data processing
- RWBfDPT: FMRI preprocessing toolbox for the whole brain of mice and rats
- SAM suite: synthetic aperture magnetometry tools for MEG source localization
- Scanbuddy: fMRI motion plotting and SNR estimation at scan acquisition
- XCP-D: fMRI post-processing and noise regression pipeline
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:
- Cox RW, Ashburner J, Breman H, Fissell K, Haselgrove C, Holmes CJ, Lancaster JL, Rex DE, Smith SM, Woodward JB, Strother SC (2004). (sort of) new image data format standard: NiFTI-1. Presented at the 10th Annual Meeting of the Organization for Human Brain Mapping.
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
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.