ome / ZarrReader

Other
7 stars 11 forks source link

Fix class cast and labels issue. #98

Open dominikl opened 1 month ago

dominikl commented 1 month ago

This PR should fix two issues:

And indeed in the respective line of .zattr

"coefficient" : 1,

It's an integer.

With this PR an Integer gets properly casted into the Double.

dominikl commented 1 month ago

I'll remove Melissa's commits again, once her PR #97 is merged.

dominikl commented 1 month ago

Showinf now works with ome.zarrs with "label" in the name. Unfortunately I still can't import them (still no imports), but now I'm really at the end my flagpole (how I'd say in German).

dominikl commented 3 weeks ago

Rebased, won't include Melissas bioformats update commit for now.

dominikl commented 3 weeks ago

How to test

'labels' issue

Create an ome.zarr with bioformats2raw.

Check it with showinf and ZarrReader 0.5.2:

BF_CP=OMEZarrReader-0.5.2-jar-with-dependencies.jar showinf -nopix A-Cat.ome.zarr/.zattrs

You'll see the used files list:

Used files:
    /Users/dom/Testing/zarr/A-Cat.ome.zarr/.zattrs
    /Users/dom/Testing/zarr/A-Cat.ome.zarr/.zgroup
    ...

Change the ome.zarr name to include 'labels', e.g. mv A-Cat.ome.zarr A-Cat_labels.ome.zarr

Run again: BF_CP=OMEZarrReader-0.5.2-jar-with-dependencies.jar showinf -nopix A-Cat_labels.ome.zarr/.zattrs

Now you'll get:

************ invalid used files list ************
Used files = []

(use in omero this will lead to "no imports found")

Then use the jar from this PR:

BF_CP=OMEZarrReader-0.5.3-SNAPSHOT-jar-with-dependencies.jar showinf -nopix A-Cat_labels.ome.zarr/.zattrs

Used files:
    /Users/dom/Testing/zarr/A-Cat_labels.ome.zarr/.zattrs
    /Users/dom/Testing/zarr/A-Cat_labels.ome.zarr/.zgroup
    ...

Class cast issue

For some reason the 'omero' metadata is only read when it is part of the root dir, i.e. A-Cat.ome.zarr/.zattrs. But bioformats2raw adds everything to a 'series' 0 directory. So you have to 'flatten' it, ie. move everything in A-Cat.ome.zarr/0 one level up into the root dir A-Cat.ome.zarr (including the .zattr and .zgroup files!) Then run: BF_CP=OMEZarrReader-0.5.2-jar-with-dependencies.jar showinf A-Cat.ome.zarr/.zattrs

Get:

Exception in thread "main" java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Double (java.lang.Integer and java.lang.Double are in module java.base of loader 'bootstrap')
    at loci.formats.in.ZarrReader.parseOmeroMetadata(ZarrReader.java:933)
    ...

With the ZarrReader from the PR: BF_CP=OMEZarrReader-0.5.3-SNAPSHOT-jar-with-dependencies.jar showinf A-Cat.ome.zarr/.zattrs Works as expected.