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
28 stars 21 forks source link

Layer name only contains first character from a multi-scale 2D image #80

Open andy-sweet opened 1 year ago

andy-sweet commented 1 year ago

When writing a multi-scale image with a name using ome_zarr.writer.write_multiscale, I'd expect to be get that name when reading the layer back in with the reader plugin in this repo.

However, instead the name is truncated to the first character.

Here's a test that I'd expect to pass, but fails because assert "k" == "kermit" fails.

def test_read_multiscale_2d_image_with_name(path: str):
    from ome_zarr.writer import write_multiscale
    from napari_ome_zarr import napari_get_reader
    import zarr
    data = [np.zeros((64, 32)), np.zeros((32, 16))]
    store = parse_url(path, mode="w").store
    root = zarr.group(store=store)
    write_multiscale(data, group=root, name="kermit")

    reader = napari_get_reader(path)
    layers = reader(path)

    assert len(layers) == 1
    _, read_metadata, _ = layers[0]
    assert read_metadata["name"] == "kermit"