Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

nifti-js

1.0.1 • Public • Published

NIfTI support for Javascript

This can parse files in the Neuroimaging Informatics Technology Initiative format (version 1). Currently, data (as opposed to the header) can only be read from ".nii" files (files that include both the header and the data in one file), you can still read the header from a header-only file though.

build status

Note that the output is compatible with what is output by nrrd-js. The main area where this breaks down (so far) is encoding orientation information. The NIfTI file format allows for two different transformations in one file (with various options for specifying the transformations). In contrast, the NRRD format only supports a very simple scheme whereby the "data axes" can be mapped to basis vectors in the physical space (in addition to another scheme more or less corresponding to "method 1" in the NIfTI format). Currently, nifti-js simply discards one type of transformation (the sform transformation).

Also note that for now quite a lot of what is read from the NIfTI file is discarded. The idea is that eventually most of what is now discarded should be mapped to NRRD attributes as much as possible, with the rest mapping to key/value pairs (for example).

Example

To use with ndarray, proceed as follows:

var file = nifti.parse(...);
var array = ndarray(file.data, file.sizes.slice().reverse());

Install

Install using npm:

npm install nifti-js

API

require("nifti-js").parse(buffer)

Parses header and data from buffer, returning an object with NRRD-compatible properties. Expects an ArrayBuffer or Buffer object.

require("nifti-js").parseHeader(buffer)

Parses just the header from buffer, returning an object with NRRD-compatible properties. Expects an ArrayBuffer or Buffer object.

require("nifti-js").parseNIfTIHeader(buffer)

Parses just the header from buffer, returning an object with the raw NIfTI information. Expects an ArrayBuffer or Buffer object.

License

(c) 2015 Jasper van de Gronde. MIT License

Keywords

install

npm i nifti-js

Downloadsweekly downloads

146

version

1.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability