Skip to content

Commit cb2e9d4

Browse files
authored
Allow handling remote zarr with trailing slashes (#62)
# References and relevant issues Remote (and local) zarr paths with trailing slashes were not accepted by bioio / ndevio This patches that behavior
1 parent efa25b1 commit cb2e9d4

File tree

5 files changed

+14
-3
lines changed

5 files changed

+14
-3
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ If you would like to try out ndevio, you can run napari in a temporary environme
4545
uvx --with ndevio -p 3.13 "napari[all]"
4646
```
4747

48+
You can even try an example remote zarr image, like from the [OME-NGFF samples](https://idr.github.io/ome-ngff-samples/):
49+
50+
```bash
51+
uvx --with ndevio --with pyqt6 -p 3.13 "napari>=0.7.0" --plugin ndevio "https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0048A/9846152.zarr/"
52+
```
53+
4854
To contibute to ndevio or experiment with the latest features, see [Contributing.md](CONTRIBUTING.md) for development setup instructions. Conda-forge availability is coming soon!
4955

5056
### Additional Image Format Support

scripts/napari_patterns_snippet.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ filename_patterns: [
1919
'*.sldy', '*.sm2', '*.sm3', '*.spc', '*.spe', '*.spi', '*.spider', '*.stk', '*.stp', '*.svs',
2020
'*.sxm', '*.tf2', '*.tf8', '*.tfr', '*.tga', '*.tif', '*.tiff', '*.tiles.ome.tif', '*.tnb', '*.top',
2121
'*.txt', '*.v', '*.vms', '*.vsi', '*.vws', '*.wat', '*.wlz', '*.xdce', '*.xml', '*.xqd',
22-
'*.xqf', '*.xv', '*.xvthumb', '*.xys', '*.zarr', '*.zfp', '*.zfr', '*.zif', '*.zvi',
22+
'*.xqf', '*.xv', '*.xvthumb', '*.xys', '*.zarr', '*.zarr*', '*.zfp', '*.zfr', '*.zif', '*.zvi',
2323
]

src/ndevio/bioio_plugins/_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
BIOIO_PLUGINS = {
6060
# OME formats with excellent metadata preservation
6161
'bioio-ome-zarr': {
62-
'extensions': ['.zarr'],
62+
'extensions': ['.zarr', '.zarr*'],
6363
'description': 'OME-Zarr files',
6464
'repository': 'https://github.com/bioio-devs/bioio-ome-zarr',
6565
'core': True,

src/ndevio/napari.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ contributions:
5757
'*.sldy', '*.sm2', '*.sm3', '*.spc', '*.spe', '*.spi', '*.spider', '*.stk', '*.stp', '*.svs',
5858
'*.sxm', '*.tf2', '*.tf8', '*.tfr', '*.tga', '*.tif', '*.tiff', '*.tiles.ome.tif', '*.tnb', '*.top',
5959
'*.txt', '*.v', '*.vms', '*.vsi', '*.vws', '*.wat', '*.wlz', '*.xdce', '*.xml', '*.xqd',
60-
'*.xqf', '*.xv', '*.xvthumb', '*.xys', '*.zarr', '*.zfp', '*.zfr', '*.zif', '*.zvi',
60+
'*.xqf', '*.xv', '*.xvthumb', '*.xys', '*.zarr', '*.zarr*', '*.zfp', '*.zfr', '*.zif', '*.zvi',
6161
]
6262
widgets:
6363
- command: ndevio.make_plugin_installer_widget

src/ndevio/nimage.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ def __init__(
137137
"""Initialize an nImage with an image, and optionally a reader."""
138138
from bioio_base.exceptions import UnsupportedFileFormatError
139139

140+
# Strip trailing slashes from string paths/URLs (e.g. `store.zarr/`)
141+
# so that bioio's extension-based reader detection works correctly.
142+
if isinstance(image, str):
143+
image = image.rstrip('/')
144+
140145
resolved_reader = _resolve_reader(image, reader)
141146

142147
# Try preferred/explicit reader first, fall back to bioio default

0 commit comments

Comments
 (0)