A JavaScript NIfTI file format reader.
Clone or download
Latest commit 19ecc9d Apr 9, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
release/current new build Jan 16, 2017
src fixed isNIFTI() bug when file is less than NIFTI header size Jan 16, 2017
tests fix for dims[5] not taken into account #2 Mar 10, 2016
.gitignore cleaned up build scripts Feb 5, 2016
LICENSE added license Feb 5, 2016
README.md Update README.md Apr 9, 2017
bower.json cleaned up build scripts Feb 5, 2016
build.properties new build Jan 16, 2017
package.json 0.5.4 Jan 16, 2017

README.md

NIFTI-Reader-JS

A JavaScript NIfTI file format reader. This reader supports both NIfTI-1 and NIfT1-2 file formats, both compressed (.nii.gz) and uncompressed (.nii).

Usage

API and more examples

var data = // an ArrayBuffer
var niftiHeader = null,
    niftiImage = null,
    niftiExt = null;

if (nifti.isCompressed(data)) {
    data = nifti.decompress(data);
}

if (nifti.isNIFTI(data)) {
    niftiHeader = nifti.readHeader(data);
    console.log(niftiHeader.toFormattedString());
    niftiImage = nifti.readImage(niftiHeader, data);
    
    if (nifti.hasExtension(niftiHeader)) {
        niftiExt = nifti.readExtensionData(niftiHeader, data);
    }
}

Install

Get a packaged source file:

Or install via NPM:

npm install nifti-reader-js

Or install via Bower:

bower install nifti-reader-js

Testing

npm test

Building

See the release folder for the latest builds or build it yourself using:

npm run build

This will output nifti-reader.js and nifti-reader-min.js to build/.

Acknowledgments

NIFTI-Reader-JS makes use of the following third-party libraries:

  • pako — for GZIP inflating