allen-cell-animated / volume-viewer

https://allen-cell-animated.github.io/volume-viewer/
Other
92 stars 7 forks source link

Update isosurfaces on new data #201

Closed frasercl closed 6 months ago

frasercl commented 6 months ago

Closes allen-cell-animated/website-3d-cell-viewer#189, resolving two related problems with isosurfaces:

  1. The visibility of a channel's isosurface doesn't count towards its being "required" to load. I.e., if a channel is disabled in the volume but its isosurface is enabled, the channel is still marked as "not required" and its data will not be reloaded when some event requires it (time change, switch to single-slice mode, etc.).
  2. Even while a channel is considered "required," isosurfaces aren't regenerated when new data is loaded, notably while playing through time.

While working on this change, I discovered that the viewer exposed two distinct code paths for changing isosurface settings. One was a set of basically stateless methods (createIsosurface, updateIsosurface, etc.) and the other was via the newer setChannelOptions. The example app in this repo uses the first method, while website-3d-cell-viewer uses the second. Since for a number of reasons we now prefer to use a single state-updating method in cases like this, I removed the first code path and updated the test app. So now I get to submit everyone's favorite kind of pull request: one with a net negative effect on the size of the codebase!