allen-cell-animated / volume-viewer

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

allow lut controlpoints to be out of our 0-255 range; simplify remapping #202

Closed toloudis closed 6 months ago

toloudis commented 6 months ago

Context: When playing through time series data, we have to adjust our lookup table to account for intensity ranges changing in the data. However, the way we were doing it, there was too much clipping at the edges of our accepted 0-255 domain for the control points. In the case of consecutive remappings, information out of the bounds was being lost by this clipping and things would quickly look terrible - often just going to complete black or complete white.

This PR stops trying to fix up edge cases when we have to remap lookup tables during time series playback.

Instead the plan is to simply allow control points to be out of range, and build the lut array from the control points, correctly handling the out of range values.

See companion PR in website-3d-cell-viewer to properly take advantage of this. (https://github.com/allen-cell-animated/website-3d-cell-viewer/pull/210)

toloudis commented 6 months ago

there is still an edge case with respect to remapping that can happen when two controlpoints are remapped to be too close to each other and fall into the same bin... to be handled in a future PR.

toloudis commented 6 months ago

The edge case which I mentioned above was a time series that was having very anomalous remapping when time playback cycled back to zero. I discovered that the "edge case" was due to bad data: a timelapse that reports having 121 times but only data for the first 120 of them. The 121st time was returning data with min,max = 0,0 and a zero-filled array. I added one commit here that tries to ignore this scenario and doesn't reset the channel min and max to zeroes. Our code was already gracefully continuing from this scenario but with bad lookup table. There's probably a better fix down the road for handling this situation but this makes it work with the test data.