lightniing Projects About Source
All projects

Spatial Processing

Spatial preprocessing aligns neuroimaging data across modalities, sessions, and participants.

RegistrationRealignment3dvolreg3dAllineate

Linear coregistration

Linear coregistration aligns images from different modalities, sessions, or participants. Affine registration estimates translation, rotation, scaling, and shear in three dimensions. Nonlinear registration may be needed when anatomical differences cannot be represented by an affine transform.

Linear spatial normalization: native image (left), population template (middle), and transformed image (right)
Linear spatial normalization: native image (left), population template (middle), and transformed image (right)

niimath provides an optimized implementation of AFNI's 3dAllineate, with features informed by FSL FLIRT and SPM Coregister. It supports contrasts including T1- and T2-weighted MRI. The implementation is tuned for the adult human brain and is not intended for other anatomical regions or species. A WebAssembly demo runs entirely in the browser.

Spatial RegistrationSpatial normalization of various images to standard space Spatial RegistrationSpatial normalization of various images to standard spaceAFNI 3dAllineate1xAFNI 3dAllineate(OpenMP)1.5xFSL FLIRT17.9xniimath allineate76.8xniimath allineate(OpenMP)197.6x
Illustrative Spatial Processing benchmark figure

Benchmark source

Motion correction

Head motion during functional MRI (fMRI) introduces spatial misalignment between volumes. This can produce spurious voxel-wise intensity changes and spin-history artifacts. Motion correction, also called spatial realignment, models the head as a rigid body and estimates translation and rotation. lightNIIng accelerates AFNI's 3dvolreg while preserving functional equivalence.

Motion correction Five subtly translated and rotated axial images are realigned to a shared anatomical frame. Nested contour bands reveal all five coincident corrected volumes. Motion correction Rigid-body realignment places every volume in a common anatomical frame 01 Before realignment Head motion shifts each acquired volume 02 After rigid-body correction All volumes share one anatomical frame REALIGN successive volumes V1V2V3V4V5
Rigid-body realignment of successive functional MRI volumes
Motion CorrectionRealigning brain images for head motion and gradient heating Motion CorrectionRealigning brain images for head motion and gradient heatingFSL mcflirt0.81xAFNI 3dvolreg1xniimath moco3.4xniimath moco (OpenMP)18x
Illustrative Spatial Processing benchmark figure

Benchmark source

Links