ome / omero-cli-zarr

https://pypi.org/project/omero-cli-zarr/
GNU General Public License v2.0
15 stars 10 forks source link

Pixel type fix #157

Closed will-moore closed 7 months ago

will-moore commented 8 months ago

Images in OMERO with float pixelType are float-32 (f4: 4 bytes per pixel) but are currently exported as f8. E.g. https://idr.openmicroscopy.org/webclient/?show=image-10648046 was exported as https://ome.github.io/ome-ngff-validator/?source=https://uk1s3.embassy.ebi.ac.uk/bia-integrator-data/S-BIAD852/971f2809-c748-4259-8044-81ba6c774fdd/971f2809-c748-4259-8044-81ba6c774fdd.zarr

This is because we have previously used np.dtype(omeroDtype) which gives the float64 dtype by default:

>>> from omero.model.enums import PixelsTypefloat
>>> PixelsTypefloat
'float'
>>> np.dtype(PixelsTypefloat)
dtype('float64')

To test:

omero zarr export Image:10648046
ome_zarr view 10648046.zarr

Should see Type: <f4

will-moore commented 8 months ago

Testing on idr-ftp

NB: we need #147 for name_option AND #156, so I've merged them together with this PR in a new branch to allow installing together (https://github.com/snoopycrimecop/omero-cli-zarr/ doesn't exist yet):

conda activate omero_zarr_export
pip install 'omero-cli-zarr @ git+https://github.com/will-moore/omero-cli-zarr@merge_prs'
...
Successfully installed omero-cli-zarr-0+untagged.486.g0b26417
joshmoore commented 8 months ago

https://github.com/snoopycrimecop/omero-cli-zarr/ doesn't exist yet

That just requires adding the submodule to https://github.com/ome/omero-plugins if you'd like to do that.

dominikl commented 8 months ago

Looks good to me. Tested it with the same image 10648046 "dtype": "<f4" 👍

cat 0/.zarray
{
    "chunks": [
        1,
        1,
        1024,
        1024
    ],
    "compressor": {
        "blocksize": 0,
        "clevel": 5,
        "cname": "lz4",
        "id": "blosc",
        "shuffle": 1
    },
    "dimension_separator": "/",
    "dtype": "<f4",
    "fill_value": 0.0,
    "filters": null,
    "order": "C",
    "shape": [
        600,
        3,
        432,
        101
    ],
    "zarr_format": 2
}%
joshmoore commented 8 months ago

Anyone up for another release in 2023?

will-moore commented 7 months ago

Merged, but can't release without fixing the versioning issue: see https://github.com/ome/omero-cli-zarr/pull/156