Git Product home page Git Product logo

ndarray-unpack's Introduction

ndarray-unpack

Converts an ndarray into an array-of-native-arrays. (Same format used by numeric.js). Like all ndarray modules this works both in node.js and in the browser.

Example

//Create an ndarray and set a value
var x = require("zeros")([5,5])
x.set(2,2,1)

//Convert ndarray into array-of-arrays
console.log(require("unpack")(x))

Install

npm install ndarray-unpack

require("ndarray-unpack")(array)

Converts array into an array-of-arrays style array.

  • array is an ndarray

Returns An array-of-arrays having the same contents as array

Credits

(c) 2013 Mikola Lysenko. MIT License

ndarray-unpack's People

Contributors

mikolalysenko avatar

Stargazers

 avatar Sagar DV avatar Michael Anthony avatar Athan avatar Kyle Robinson Young avatar

Watchers

 avatar Dmitry Iv. avatar James Cloos avatar Michael Anthony avatar Athan avatar  avatar

ndarray-unpack's Issues

TypeError: a0.get is not a function

I have 245 images, each size 512x512(A ct scan set containing a series of dicom images). I created a image volume out them using an external library and converted that to a ndarray which is in this format:

View3dgeneric {
  data: ArrayBuffer {},
  shape: [ 512, 512, 245 ],
  stride: [ 125440, 245, 1 ],
  offset: 0 
}

From there I have taken a slice of an image in the series (as they are dcm set and are in the form of a volume) like this :

var img = volume.pick(null,256,null);

and I get the output of img as this :

View2dgeneric {
  data: ArrayBuffer {},
  shape: [ 512, 245 ],
  stride: [ 125440, 1 ],
  offset: 62720 
}

Now when I try to unpack the image like this :

console.log(unpack(img))

It gives me an error message as given in the title :

undefined:13
    _inline_1_v[index[index.length-1]]=a0.get(p0)
                                          ^

TypeError: a0.get is not a function
    at unpackCwise_cwise_loop_1s0m2g (eval at generateCWiseOp (/usr/lib/node_modules/ndarray-unpack/node_modules/cwise/node_modules/cwise-compiler/lib/compile.js:351:11), <anonymous>:13:43)
    at unpackCwise_cwise_thunk (eval at createThunk (/usr/lib/node_modules/ndarray-unpack/node_modules/cwise/node_modules/cwise-compiler/lib/thunk.js:82:15), <anonymous>:7:53)
    at Function.unpack (/usr/lib/node_modules/ndarray-unpack/unpack.js:19:3)
    at /home/sagar/Repositories/Scripts/Projects/node/boneAR/boneAR/CTGen.js:121:27
    at daikon.Series.concatenateNextImageData (/home/sagar/Repositories/Scripts/Projects/node/boneAR/boneAR/daikon-min.js:17:1252)
    at null.<anonymous> (/home/sagar/Repositories/Scripts/Projects/node/boneAR/boneAR/daikon-min.js:17:1671)
    at null._onTimeout (/home/sagar/Repositories/Scripts/Projects/node/boneAR/boneAR/daikon-min.js:17:22391)
    at Timer.listOnTimeout (timers.js:92:15)

Is there way to get around this problem. The basic example given in the docs work, but when it comes to this, it doesnt work for some reason.

With regards,
Sagar DV

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.