neurosynth / nsviewer

Neurosynth viewer
28 stars 22 forks source link

Possibly switch to custom nifti reader #25

Open njvack opened 9 years ago

njvack commented 9 years ago

Hi there,

So, for a variety of reasons, I fooled around with creating a custom nifti1 reader in javascript, and made something that actually works, and a toy viewer to go along with it. Here's a demo:

http://njvack.github.io/jsnifti

... and the source:

https://github.com/njvack/jsnifti

It's small (minified and gzipped, the reader is about 19k) and fast -- parsing the structural image from the NIH test dataset takes about 20ms on Chrome/my 5-year-old Air if the file's endianness matches, and 500ms if it doesn't.

All the header fields are included (yay jBinary), and getting slices is easy (#ras_slice). Slicing and rendering in the (broken, unoptimized!) toy viewer is insanely fast (about 3ms/frame).

It's still missing some features (most notably, converting ijk <-> ras coordinates) but that shouldn't be too hard to add.

Anyhow! We may wind up using this internally, but it also might be useful for you.

tyarkoni commented 9 years ago

Ooh, this looks great! In principle I would love to use it instead of the xtk reader. It's just a matter of finding the time to work through the code and figure out how to integrate it. Probably won't happen in the next month or two (grant deadlines), but maybe in November. If you have a chance to write a README on usage and data structure, that will probably speed things along. I'm excited about this!

I've also been contemplating a complete re-write of the UI in React or something similar, so that might be a good time to switch to jsnifti...

njvack commented 9 years ago

Yeah, a "non-empty README" is pretty close to the top of my list. Sweet!

I have a couple other projects to get to here, but I'll do more with this after.