bioio-devs / bioio-ome-zarr

A BioIO reader plugin for reading Zarr files in the OME format.
BSD 3-Clause "New" or "Revised" License
0 stars 2 forks source link

Bug: Z size off by one #21

Closed pgarrison closed 2 months ago

pgarrison commented 2 months ago

Describe the Bug

Bio-Io reports that the size in the Z dimension is one less than the true number of Z levels. Tested on a ZARR with Z folder names from 0 to 108 (inclusive), so there should be 109 levels available.

Reproduction

from bioio import BioImage
path = "https://allencell.s3.amazonaws.com/aics/nuc_morph_data/data_for_analysis/baseline_colonies/20200323_09_small/seg.ome.zarr"
img = BioImage(path)
assert img.shape[2] == 109

I checked (with a bash script) that every timepoint of that example ZARR has 109 folders for the Z dimension.

Environment

Python 3.9.18
bioio 1.0.2
bioio-base 1.0.1
bioio-ome-zarr 1.0.1
toloudis commented 2 months ago

The .zarray metadata for level 0 shows this:

    "chunks": [
        1,
        1,
        1,
        3120,
        4560
    ],
    "compressor": {
        "blocksize": 0,
        "clevel": 5,
        "cname": "lz4",
        "id": "blosc",
        "shuffle": 1
    },
    "dimension_separator": "/",
    "dtype": "<u2",
    "fill_value": 0,
    "filters": null,
    "order": "C",
    "shape": [
        570,
        1,
        108,
        3120,
        4560
    ],
    "zarr_format": 2
}

So it thinks there are 108 z slices according to the shape metadata.

toloudis commented 2 months ago

We might have to look into how it was generated. Do we know whether it's supposed to be 108 or 109 from the original image source?

pgarrison commented 2 months ago

Thanks @toloudis, looking into ome-zarr-conversion instead