-
Notifications
You must be signed in to change notification settings - Fork 6
Description
There are cases when you have already loaded the zarr.json or .zattrs for a multiscale image before you want to create a thumbnail:
- In use ome-zarr.js for renderImage() ome/ome2024-ngff-challenge#93 we load the
imgAttrsfor zarr v3 data to determine whether the URL is to a multiscales image or bioformats2raw or plate. This gives us the full URL to the image itself (e.g. first image in the plate) as well as the image attrs. - In Load 0.6.dev1 schemas from github ome/ome-ngff-validator#48 where we want to show thumbnails for each
inputimage in various coordinateTransformations, we want to check that the image exists by loading the imagezarr.json(zarr v3 only for this spec) so that we can show a nice "not found" message instead of a failed thumbnail if theinputis not valid.
In such cases, having the attrs in hand allows us to skip the loading of this in renderThumbnail(). This can save us 1 or 2 calls - since renderThumbnail() tries to load both .zattrs and zarr.json as it doesn't know if the URL is for zarr v2 or zarr v3. Having the multiscales attrs can tell us whether we are working with Zarr v2 or v3:
Zarr v2
{ "multiscales": [{"version": "0.4"...}] }
Zarr v3 (complete zarr.json)
{"ome": { "version": "0.5", "multiscales": {}. } } }
This would involve adding an imgAttrs argument at
Line 22 in 764db30
| maxSize: number = 1000 |
Then the getMultiscaleWithArray() functionality would be split into 2 parts, since the getMultiscale() wouldn't be needed.
The rest of that function, from
Line 247 in 764db30
| const paths: Array<string> = multiscale.datasets.map((d) => d.path); |
getArrayInfo().
Then, if we already have the imgAttrs, we call getArrayInfo() to return the same as getMultiscaleWithArray() but if we don't have imgAttrs, we call getMultiscaleWithArray() as now, but it calls getMultiscale() and then getArrayInfo().
@lubianat - if you're interested in working on ome-zarr.js, this could be a good start?