astrojs / fitsjs

JavaScript library for reading the FITS astronomical format. Functionality includes reading of images, data cubes, compressed images, binary and ascii tables.
http://astrojs.github.io/fitsjs/
MIT License
85 stars 21 forks source link

Access the Image data #24

Closed FlorianDubath closed 9 years ago

FlorianDubath commented 9 years ago

Probably it is just a lack of documentation (or of understanding from my side)...

However I have opened a .fits file, and the first "dataunit" is an Image. Through it I have access to the different parameters ("width","height",...) but I do not know how to access the pixel values.

I have tried the "getFrame(0,callback,opts)" but the returned "pixels" (into the callback) is undefined. I have also tried to directly build a "Float32Array" wrapping the "buffer" but the data I can extract from it seems to be random (and are certainly not the expected values)

For a file containing uint8 the array wrapping works well and I get my image, the problem seems to be specific for the float (bitpix: -32)

FlorianDubath commented 9 years ago

My bad: the order of the variable in the callback to be provided to getFrame are: