nibabel
Access a multitude of neuroimaging data formats
What it is and what it does
NiBabel is a Python library for reading and writing neuroimaging data files in a wide range of formats used in brain imaging research. It abstracts the complexity of different file formats—from NIfTI and ANALYZE to FreeSurfer MGH and AFNI BRIK/HEAD—into a unified API, allowing researchers to load image metadata and pixel data as NumPy arrays for downstream analysis.
The library is designed for neuroscience and medical imaging workflows where data often comes in proprietary or specialized formats. It handles both the structural metadata (header information) and the raw image arrays, making it a foundational tool for preprocessing pipelines, statistical analysis, and format conversion in neuroimaging research.
Use it for:
- Load fMRI or structural MRI scans from NIfTI files for statistical analysis or visualization in research pipelines.
- Convert between neuroimaging formats (e.g., DICOM to NIfTI) for compatibility with downstream tools.
- Access FreeSurfer surface geometry and morphometry data for cortical analysis.
- Extract and manipulate brain imaging metadata (voxel size, affine transforms, acquisition parameters) for quality control.
- Build automated neuroimaging workflows that read multiple format types without format-specific parsing code.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
NiBabel reads and writes neuroimaging file formats including NIfTI, ANALYZE, GIFTI, CIFTI-2, MINC, AFNI BRIK/HEAD, ECAT, Philips PAR/REC, and FreeSurfer MGH files, exposing metadata and image data via NumPy arrays.
Yes. NiBabel is a stable, actively maintained library with no known vulnerabilities, low install friction, and permissive licensing. It is the de facto standard for neuroimaging file I/O in Python and essential for anyone working with brain imaging data in research or clinical contexts.
Install
nibabel on PyPI
pip
pip install nibabeluv
uv add nibabelpoetry
poetry add nibabelInstalling nibabel
Before you install
Low friction install with four lightweight runtime dependencies (numpy, packaging, importlib-resources, typing-extensions). Active maintenance with a recent release (156 days ago) and ongoing repository activity.
License in practice
MIT license permits commercial and private use with minimal restrictions; some bundled code uses BSD license. See COPYING file for full details.
Quickstart
pip install nibabel
import nibabel as nib
img = nib.load('scan.nii.gz')
data = img.get_fdata()
Requires Python 3.10 or later.
Verify before relying
- Whether the package handles all listed formats with equal completeness or if some are read-only or have limited support beyond what 'limited support for DICOM' indicates.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — importlib-resources, numpy, packaging, typing-extensions |
| Maintenance | actively maintained — 156 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,957,737/month — #3,409 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: nibabel-5.4.2-py3-none-any.whl
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
nipypeNipype provides a uniform Python interface to…
permissive · top 15,000 on PyPI
pynrrdReads and writes NRRD (Nearly Raw Raster Data)…
permissive · top 15,000 on PyPI
neoNeo provides a unified data model for…
permissive · top 15,000 on PyPI
pyxnatpyxnat provides Python bindings to interact…
permissive · top 15,000 on PyPI
pybidsPyBIDS provides a Python interface to query,…
permissive · top 15,000 on PyPI
bidsschematoolsParse, validate, and export the Brain Imaging…
permissive · top 15,000 on PyPI
GridDataFormatsGridDataFormats reads and writes n-dimensional…
copyleft · top 15,000 on PyPI
mne-bidsMNE-BIDS reads and writes neuroimaging datasets…
permissive · top 15,000 on PyPI
dicom2niftiConverts DICOM medical imaging files to NIfTI…
permissive · top 15,000 on PyPI
meshioplusplusmeshioplusplus reads and writes mesh files in…
permissive · top 15,000 on PyPI