allen-cell-animated / volume-viewer

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

select optimal zarr multiresolution based on a 2kX2k tiled texture size #96

Closed toloudis closed 1 year ago

toloudis commented 1 year ago

The zarr dimension code tries to auto-select a multiresolution level to display. The autoselection of multiresolution level was picking the worst resolution even if a better one would fit.
This fix computes an estimate of the best multiresolution layer based on how we would ideally tile the z slices in our internal texture for rendering. The code in the zarr loader is a bit ugly because I want to remap the dimension order back to TCZYX even if it is ordered differently inside the file. So there are some indirections through the index remappings. Some of this remapping stuff was being repeated in two places so I did a DRY refactor into functions.

The result of this code is that the zarr loader won't always just select the worst resolution.