Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is .zarr/ suffix strictly required? any other ".subsuffixes." considered (like in .ome.zarr) #738

Open
yarikoptic opened this issue Feb 16, 2024 · 3 comments

Comments

@yarikoptic
Copy link

For DANDI we are considering to implement custom support for zarr "filesets" versioning.
There is an experimental webdav which is reverse proxied by apache at is https://dandi.centerforopenneuroscience.org .

What we discovered, is that despite the fact that our integration works just fine for URLs like https://kitware.github.io/itk-vtk-viewer/app/?gradientOpacity=0.3&image=https://dandiarchive.s3.amazonaws.com/zarr/6c18ad23-8bc9-404e-b902-d9ccb598dfca (BTW, doesn't work if you add trailing / since then it doesn't strip it before adding /.zattrs and fails), it does not work for https://kitware.github.io/itk-vtk-viewer/app/?gradientOpacity=0.3&image=https://dandi.centerforopenneuroscience.org/zarrs/6c1/8ad/6c18ad23-8bc9-404e-b902-d9ccb598dfca/c33f80763aafea111b5c51c291b22238-83143--96359783338 or with trailing / and you get just
image
with console showing
image

But if I add .zarr/ (through rewrite at apache level to remove .zarr for the forwarded to webdav URL) -- it works: https://kitware.github.io/itk-vtk-viewer/app/?gradientOpacity=0.3&image=https://dandi.centerforopenneuroscience.org/zarrs/6c1/8ad/6c18ad23-8bc9-404e-b902-d9ccb598dfca/c33f80763aafea111b5c51c291b22238-83143--96359783338.zarr

So the question is really - is .zarr suffix required for the tool? but then how come it works for original URL pointing to S3 prefix?

Also, looking forward -- is subsuffix, like .ome in .ome.zarr somehow important/used? (I hope not)

Thank you in advance for the answers/ideas.

@PaulHax
Copy link
Collaborator

PaulHax commented Feb 17, 2024

Thanks for the well researched issue =)

The second URL is not recongzied as a zarr image because it has /zarrs/ rather than /zarr/ like the first URL. There is a regular expression testing if a image URL shall be treated as a zarr image:

// ends with zarr and optional nested image name like foo.zarr/image1
export const isZarr = url => /\w[./]zarr\b/.test(url)

So adding the .zarr at the end passes the RegEx test. A few more positive and negative zarr URL examples here:

test('Test isZarr', t => {
t.true(isZarr('foo.zarr'), 'no suffix')
t.true(isZarr('foo.zarr/0'), '/0 suffix')
t.true(isZarr('foo.zarr/asdf'), '/asdf suffix')
t.true(isZarr('foo/zarr/asdf'), 'no dot before zarr')
t.true(
isZarr(
'https://dandiarchive.s3.amazonaws.com/zarr/3d313fc2-0204-496d-bfa1-5c90951ee640'
),
'real url'
)
t.true(isZarr('https://site.com/zarr/a/b'), 'deep nested image')
t.true(
isZarr('https://site.com/foo.zarr/a/b'),
'deep nested image with zarr as extension'
)
t.false(isZarr('zarr.asdf'), 'not when .asdf extension')
t.false(
isZarr('barzarr.asdf'),
'not when .asdf extension withfilename barzarr'
)
t.false(
isZarr('barzarr.asdf/asdf'),
'not when .asdf extension and has suffix'
)
t.false(isZarr('foo.zarrX'), '.zarrX extension, not .zarr')
t.end()
})

Zarr URL format does seem to be a continual pain point:
#721

We could add another URL parameter &zarr that always treats the URL as a zarr image. Or change the toMulticalseSpatialImage logic:

if (isZarr(image.href)) {

.ome is not checked/used.

@yarikoptic
Copy link
Author

+1 on adding explicit option to specify the format - "explicit better than implicit" they said while language is called after a part of the name of a movie coincidental with a full name of a snake...
What other formats do you consider that you can't/don't want to sense for having some /.zgroup or /.zattrs or even just trying to open it as a zarr for that URL?

@yarikoptic
Copy link
Author

FYI, we now addressed this on our (dandidav) end by adding .zarr/ to those listings of zarrs so now we natively have https://dandi.centerforopenneuroscience.org/zarrs/001/e3b/001e3b6d-26fb-463f-af28-520a25680ab4/326273bcc8730474323a66ea4e3daa49-113328--97037755426.zarr/ and no analogous without .zarr/ (so examples above might no longer reproduce). Let us know if you would need/like to try on some older version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants