allen-cell-animated / website-3d-cell-viewer

Other
5 stars 5 forks source link

Allow multiple data sources for zarr volumes #207

Closed frasercl closed 5 months ago

frasercl commented 5 months ago

Review time: pretty quick (~20min)

Closes allen-cell-animated/volume-viewer#78: allow users to take advantage of volume-viewer's new ability to load zarrs from multiple data sources.

This PR makes the following breaking changes to the viewer API:

Viewer component: replace the cellPath, fovPath, and baseUrl props with imageUrl and parentImageUrl.

Like the props they replace, imageUrl and parentImageUrl specify the paths from which to load image data. They correspond to the old cellPath and fovPath props, respectively, in that they specify what CFE calls "single cell" and "full field" images. However, they are different from the old set of data-loading props in the following ways:

CFE will have to be updated to use these new props.

Public app: remove image url parameter and add url2.

image, when present, behaved like the cellPath to url's baseUrl. This was basically never used, since it was just as easy to specify the full url in url. So now it's gone.

In its place is url2, which adds a second zarr source (or JSON time step, I guess) to the loaded image. After some discussion about how we might support arbitrarily many source urls, we decided that just two sources would be good enough to support 95% of realistic use cases for this feature. (If anyone has any bright ideas about how to safely delimit a list of arbitrary URLs within another URL, let me know.)

To test:

frasercl commented 5 months ago

Most recent change modifies the API described above: url2 is gone; now multiple source URLs may be passed in as a comma-delimited list in url, ideally sanitized with encodeURIComponent. This seems to be the actual ideal way to encode multiple URLs in a single URL. We should make sure to be diligent in the future about using encodeURIComponent in URL sharing dialogs or auto-updating URLs.