hanayik / niivue

a WebGL2 based NIFTI volume viewer.
https://hanayik.github.io/niivue
BSD 3-Clause "New" or "Revised" License
11 stars 7 forks source link

Faster, smaller, (almost) ready for overlays #75

Closed neurolabusc closed 3 years ago

neurolabusc commented 3 years ago

New features:

Limitations:

To Do:

hanayik commented 3 years ago

New features:

  • Supports DT_FLOAT64.
  • Uses compute shader to reorient volumes (both background and overlays). Order of magnitude faster than prior CPU-based method.
  • Scroll-wheel and pinch gestures work on multi-plane view.
  • Global overlayItem replaced with back properties that describe dimensions and orientation of background image.

I kept back but just set it as volumes[0] (it references the first item in the volume array)

  • webgl.md expanded to describe compute shader rotation implementation, performance and limitations.

Limitations:

  • Reslicing overlays is always NEAREST, not LINEAR (only normalized values are Texture filterable). Not major concern as NEAREST is often preferable for statistical overlays. Not a problem when 1-to-1 mapping exists between overlay and background.

To Do:

  • Check rendering on Google Chrome for Windows (ANGLE uses DirectX)

DONE. I tested on my Windows Dell XPS using Brave (browser based on Chrome). Also tested Firefox on that same machine. No formal tests, but things seem to work ok.

  • Compute spatial transform for overlay to background (a few lines of code, need functioning overlay loading).
  • First call to loadVolume() should await completion of init(). At the moment, first volume loads before font is ready.

I believe I handled this, or at least some related side effects when loading more than one volume at a time. see loadVolumes and refresh

  • Colorbar only draws colormap for top-most layer.

I have manually fixed all the merge conflicts between our two branches (font, and prototype). Main branch now reflects the state of the art combination of our efforts. Niivue is now an object (pretty much as class). All Niivue properties and methods are part of a Niivue instance. Those properties and methods can be accessed within the Niivue library as this.MyProperty, or this.MyMethod. When creating new methods to be used in Niivue you should assign the method to the Niivue object within the Niivue library as Niivue.prototype.MyNewMethod = function(arg1, argN) { //content}. If you use a nested function within a Niivue prototype you will need to bind this this context to that nested function like so: myNestedFunc = function(arg1, argN) { // content}.bind(this).

Closing this PR since main now has all of these additions after merging both font and prototype