allen-cell-animated/volume-viewer

last z slice can fail to display

Closed this issue · 3 comments

Description

When loading some data sets, and going into XY mode and moving slider to last slice, sometimes the last slice shows up completely black. ( A preliminary debugging shows that the single-slice shader thinks the Z value is out of bounds (greater than 1) in this scenario )

Expected Behavior

Expect to be able to see every Z slice when in XY mode.

Reproduction

https://allen-cell-animated.github.io/website-3d-cell-viewer/viewer?url=https%3A%2F%2Fdev-aics-dtp-001.int.allencell.org%2F%2Fassay-dev%2Fcomputational%2Fdata%2Frelease%2Femt-data%2Fmain%2F3500006256_20X_P12_B10%2Fraw.ome.zarr%2F
Go to XY mode.
move z slider to max value.
Data will never show up.

See this line in the shader:
pos.xyz = (pos.xyz - SUBSET_OFFSET) / SUBSET_SCALE;

We might have some floating point error that pushes this out of bounds when you have a 1x1 atlas
Removing that line makes this data show up again. Haven’t tested on any other images.
For this data, SUBSET_OFFSET.z = 0.9667 and SUBSET_SCALE.z = 0.0333 (approx 29/30 and 1/30)

Confirmed that was pushing pos.z > 1.0
Changing the bounds check in sampleAtlas to have an epsilon also fixes it:
pos[2] >= 0.0 && pos[2] <= 1.0001); // used to be 1.0

(1.0-0.9666)/(0.0333) > 1.0

Closed by #224