0

I have read here:

Is there a way to use a Custom cross-sectional slicer of 3d image data?

... that the nrrd parser stores the image data as a 3D array. I want to be able to access this array in my scripts. How can this be done? I would like to use this data to do image statistics, and subsets to do region of interest statistics. I believe the data is a private variable which is just used by the slice function to create the volume slices, is that correct? If so how can I save it for later use as a public variable, or as a property of the volume object?

Please explain as simply as possible how to proceed as I am quite a novice at javascript.

Many thanks,

Community
  • 1
  • 1
neurovis
  • 21
  • 5
  • Haehn would know that, but I think the 3D array computed in the parser is detroyed at the end of the parsing : indeed at the end of file reading, the parser calls a function that make slices from the 3D Array. So I think you'd need to make some little changes in the source code. Do you work under Linux ? – Ricola3D Aug 03 '12 at 10:30
  • Hi thanks. I am working in mac OS X 10.7. I use coda 2 as my development environment. At the moment I do not have quite the understanding to know how to change the source-code to keep the 3D array data available. I have looked through parserNNRD.js and am a little confused. How would be the most efficient way to implement this? There is also a property of volumes called filedata, which is described as 'possibly attached' in the comments. Maybe the 3D data array is part of filedata if filedata is attached. – neurovis Aug 03 '12 at 12:56
  • The filedata holds the whole content of the file (unparsed so), so you'd have to parse it to get the points. So complicated and the same operation made twice. I've to think a bit about a way.. or to pray Haehn comes back since I'm a newbie with the X.volume class :) – Ricola3D Aug 03 '12 at 14:58
  • Ok yeah agreed. The 3d image data is saved at line 629 of parser.js . It is still not clear to me how to edit the source to create a getter for this array but I am starting by reading the google closure documentation in order to understand better. I also plan to look for other getters of volume objects as a guide to how it is done. Bit of a baptism of fire into javascript but its a pleasure to see how it works, really great work from Haehn. – neurovis Aug 05 '12 at 13:37
  • You'd have to first save the value of "datastream" as an attribute of X.parserNRRD : for example define an attribute in the constructor "this._voxels = null;", then in the "parse" method add the line "this._voxels = datastream;" at line 122. For the getter, use the syntax Haehn chose "X.parserNRRD.prototype.__defineGetter__('voxels', function() { return this._voxels; });" and it should be enough. But it wont be so easy, unlike you load the file with this parser by yourself. Because the renderer, when you give him a filename, calls the right parser but doesn't save him I think.. – Ricola3D Aug 06 '12 at 07:28
  • Ah yes that seems logical about the datastream and voxel attribute. I do not understand your last points but it sounds like it may not be so easy to get the data as I was expecting. I have opened an issue here: https://github.com/xtk/X/issues/84 to get help, (my background is not software development as you might have guessed by now!) – neurovis Aug 06 '12 at 10:48

1 Answers1

0

We didn't store the array for all volume parsers yet to slim down the memory usage. This can certainly be added since the infrastructure is there under the hood.

I assigned the issue to me

https://github.com/xtk/X/issues/84

haehn
  • 967
  • 1
  • 6
  • 19