allen-cell-animated / volume-viewer

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

Make `VolumeCache` more generic #152

Closed frasercl closed 10 months ago

frasercl commented 10 months ago

Use Case

VolumeCache was originally written to store arrays representing arbitrary volume subsets, but is now used to represent a fixed set of zarr chunks. It no longer needs to know the dimensions of the volume it contains, or even that its entries represent volume subsets at all.

Solution

Design some changes to make VolumeCache more generic, implement them, update relevant tests, and use the new API in loaders.

There should be no noticeable difference in behavior after this change.

toloudis commented 10 months ago

I saw something in the cache code that gave me this idea: cache keys are strings of the form "volume_id/zarr/chunk/subpath" and you can still do things like removeAllWithPrefix by searching for all keys with a given prefix, in order to remove only chunks associated with a volume_id.