allen-cell-animated / volume-viewer

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

Reload slice if it will load at a higher resolution level #157

Closed frasercl closed 9 months ago

frasercl commented 10 months ago

Description

Currently, when the user switches from 3D to z-slice mode in a zarr image, the image remains at the scale level chosen for 3d rather than loading a higher scale level for 2D.

Expected Behavior

The viewer should recognize when a new load would fetch a different scale level and issue a new load.

Solution

This is due to the check made by Volume.updateRequiredData: it determines that since the time has not changed and the 2d slice is contained within the 3d volume, it does not need to load new data.

Part of the solution could come from adapting the loader interface method loadDims. This method is currently unused in the app, and the type it returns, VolumeDims, has remained constant through five or six revisions of the similar LoadSpec type. This seems like the appropriate method to ask a loader which scale level it would load with a given LoadSpec.

This is also a light form of #115, since the slice will be immediately displayed at 3D resolution first before new data is loaded. Future work might be to check if the data required by a load is present in the cache at a lower scale level, so that it can be loaded immediately while new data is fetched from the server.