Neverending Programming Mistakes

nrrd-js

0.2.1 • Public • Published

NRRD support for Javascript

This can parse and serialize files in the Nearly Raw Raster Data format. Currently it only supports inline data (although in principle there is parsing support for datafile, and if you take care of the external data yourself writing headers using external data should also work).

To use with ndarray, proceed as follows:

var nrrdfile = nrrd.parse(...);
var array = ndarray(nrrdfile.data, nrrdfile.sizes.slice().reverse());
var arrayBuffer = nrrd.serialize({data: array.data, sizes: array.shape.slice().reverse()});
// If array.data is something other than a typed array, you should specify the 'type'.

Note that the above serialization only works if the ndarray uses the default stride(s), if not, then you essentially need to copy the ndarray into a new one that does (or at least a new typed array).

Keywords

none

install

npm i nrrd-js

Downloadsweekly downloads

69

version

0.2.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

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