Fast R and C++ Access to NIfTI Images
Overview
Provides very fast read and write access to images stored in the NIfTI-1, NIfTI-2 and ANALYZE-7.5 formats, with seamless synchronisation of in-memory image objects between compiled C and interpreted R code. Also provides a simple image viewer, and a C/C++ API that can be used by other packages. Not to be confused with 'RNiftyReg', which performs image registration and applies spatial transformations.
R interface
- Methods for
asNifti()are now discoverable by the package's C++ core, which significantly reduces the need to call the function explicitly, which in turn can save some data copying. Thereferenceargument is no longer part of the generic's signature. Conversion of"nifti"and"MriImage"objects, from theoro.niftiandtractor.basepackages, respectively, is now performed by pure-R methods rather than being hardcoded into the C++ layer, a change which ends up being performance-neutral (or even an improvement) due to fewer calls into the R API. lyr()gains newlabel,alphaanddictarguments, for naming a layer explicitly (rather than relying on argument deparsing), setting layer opacity and mapping intensity values to arbitrary text, respectively. Itsscaleargument may now be a named vector, which is used as a discrete colour lookup table keyed by intensity value, rather than a continuous colour scale.
Show all changes in 1.10.0Hide the rest of the changes in 1.10.0
- Assigning pixel dimensions with
pixdim<-now produces an error if the replacement value's length doesn't match the image's dimensionality, rather than silently applying it incorrectly. - Setting the world-coordinate transformation of a
niftiHeaderobject withqform<-orsform<-no longer has the side effect of overwriting its pixel dimensions, except for the sign of the first element (the "qfac"). writeNifti()'sversionargument is now validated, and may be given as a string ("1"or"2") as well as numerically.- Assigning to
imageAttributes()now produces a warning, rather than silently doing nothing, if the assignment would overwrite a core NIfTI attribute. It also now works correctly when the target object has no pre-existing attributes. - The
mean()method for internal images now uses the same C++ back-end as theSummarygroup generic, thereby avoiding first converting the image to a full array.
API changes
- A bug in the
acquire()/release()reference-counting cycle in theNiftiImageC++ class has been fixed. Previously, changing the pointer wrapped by aNiftiImageobject by copy-assignment could decrement the wrong reference counter, risking a premature deallocation.acquire()now takes an optional existing reference counter to take over, rather than relying on it having already been set as a side effect by the caller. - Converting a NIfTI-2 image containing more voxels than a NIfTI-1 image can represent now fails with an informative error, rather than silently overflowing.
Other changes
- Reading corrupt or truncated image data now produces clearer, more informative errors.
- A memory leak affecting the internal per-datatype handler on copy assignment of a
NiftiImage, and undefined behaviour arising from use of an iterator after erasing the element it points to, have both been fixed. - C++ exceptions are now consistently raised using
Rcpp::stop()rather thanRf_error(), ensuring correct stack unwinding.
From NEWS in the release
Install
Health
- OK13 OK2026-09-08
- ERROR12 OK, 1 ERROR2026-09-07
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK12 OK2026-04-25
Show 3 earlier changesHide 3 earlier changes
- NOTE12 OK, 2 NOTE2026-04-22
- ERROR11 OK, 2 NOTE, 1 ERROR2026-04-18
- NOTE12 OK, 2 NOTE2026-03-10
Documentation
- Help pages
- 19
- Examples that run
- 91%10 run in a plain check · 1 never run
- Exported functions with examples
- 59%
- Documented parameters
- 91%
- Return-value docs
- 88%
- Help pages citing references
- 32%
Downloads
Repository
- PRs merged (all time)
- 33%
- Median days to close, 50 most recently updated closed issues
- 4
- Median days to close, 50 most recently updated closed PRs
- 2
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
Commits over time
6 development-tooling and community-health practices detected across 4 families in the upstream repository
Checks run against github.com/jonclayden/rnifti on 2026-10-21.
The R CMD check workflow runs on Linux and Windows
Dependencies
Installing RNifti adds 1 package (1 with compiled code, 1.8 MB of source tarballs). Heaviest: Rcpp 1.8 MB.
Show all 28 packagesHide all 28 packages
Code & Tests
People & History
Pick two releases to compare their code metrics.
- RR 4.6.0 released · 2026-04-24
- 1.10.0Latest
- 1.9.02026-01-13 · diff ↗
- RR 4.5.0 released · 2025-04-11
- 1.8.0
- 1.7.02024-06-19 · diff ↗
- RR 4.4.0 released · 2024-04-24
- 1.6.12024-03-07 · diff ↗
- 1.6.02024-02-15 · diff ↗
- 1.5.12023-11-28 · diff ↗
- 1.5.02023-05-17 · diff ↗
- RR 4.3.0 released · 2023-04-21
- 1.4.52023-01-30 · diff ↗
- 1.4.42023-01-16 · diff ↗
- 1.4.32022-11-07 · diff ↗
- 1.4.22022-10-31 · diff ↗
Show 34 earlier eventsHide 34 earlier events
- 1.4.12022-07-01 · diff ↗
- RR 4.2.0 released · 2022-04-22
- 1.4.02022-02-14 · diff ↗
- RR 4.1.0 released · 2021-05-18
- 1.3.12021-05-13 · diff ↗
- 1.3.02020-12-04 · diff ↗ ·
added 5 exports
extension<-, extensions<-, ExtensionCodes, extension, extensions - 1.2.32020-10-08 · diff ↗
- 1.2.22020-09-07 · diff ↗
- 1.2.12020-09-01 · diff ↗
- 1.2.0
- RR 4.0.0 released · 2020-04-24
- 1.1.0
- 1.0.12019-11-27 · diff ↗
- 1.0.0
- 0.11.12019-08-01 · diff ↗
- 0.11.02019-06-17 · diff ↗
- RR 3.6.0 released · 2019-04-26
- 0.10.02018-10-19 · diff ↗
- 0.9.0
- 0.8.12018-07-05 · diff ↗
- 0.8.0
- RR 3.5.0 released · 2018-04-23
- 0.7.12017-09-14 · diff ↗
- 0.7.0
- 0.5.12017-05-11 · diff ↗
- RR 3.4.0 released · 2017-04-21
- 0.5.02017-03-09 · diff ↗
- 0.4.0
- 0.3.02016-12-08 · diff ↗
- 0.2.22016-10-02 · diff ↗
- 0.2.12016-09-20 · diff ↗
- 0.2.02016-09-20 · diff ↗
- 0.1.02016-09-01
- RR 3.3.0 released · 2016-05-03
Package metadata
- First published
- 2016-09-01
- Total releases
- 39 / 10 yrs
- License
- GPL-2 OSI
- Download size
- 1.5 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("RNifti")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.