ome / napari-ome-zarr

A napari plugin for zarr backed OME-NGFF images
https://www.napari-hub.org/plugins/napari-ome-zarr
BSD 3-Clause "New" or "Revised" License
27 stars 21 forks source link

Allow any filepath that *contains* zarr #58

Closed will-moore closed 2 years ago

will-moore commented 2 years ago

Currently, file paths recognised by napari-ome-zarr must end in .zarr or .zarr/. However, this doesn't support viewing of HCS Wells or Images.

As suggested by DragaDoncila at https://github.com/ome/napari-ome-zarr/pull/55#issuecomment-1171362735, this PR allows the path to contain .zarr at any point

To test, open a Well and Image from a Plate. NB: opening the plate itself .zarr/ still works:

# Well (screenshot)
$ napari --plugin napari-ome-zarr https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.1/plates/7825.zarr/A/1/

# Image:
$ napari --plugin napari-ome-zarr https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.1/plates/7825.zarr/A/1/0/

# Plate:
$ napari --plugin napari-ome-zarr https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.1/plates/7825.zarr/

Without this PR, opening an unrecognised path as above gave:

  File "/Users/wmoore/opt/anaconda3/envs/napari-env/lib/python3.9/site-packages/napari/plugins/io.py", line 86, in read_data_with_plugins
    raise ValueError(
ValueError: There is no registered plugin named 'napari-ome-zarr'.
Names of plugins offering readers are: {'ome-types', 'builtins'}

Screenshot 2022-06-30 at 17 23 51

cc @sbesson

joshmoore commented 2 years ago

Interesting!

As a side note, there was some discussion yesterday during the Zarr community call about making /.zarr\// the definitive definition of where the root of a fileset is in V3, but there were other proposals as well.

will-moore commented 2 years ago

I have a marginal preference for keeping *.zarr for clarity - and I like a 1-character PR! But no strong preference.