webknossos icon indicating copy to clipboard operation
webknossos copied to clipboard

OME NGFF coordinateTransformations translate

Open will-moore opened this issue 3 years ago • 2 comments

Context

Tried importing OME NGFF sample at https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr This has a 'translation' in the datasets coordinateTransformations:

"datasets": [
                {
                    "coordinateTransformations": [
                        {
                            "scale": [
                                1.0,
                                1.0,
                                0.4,
                                0.108335,
                                0.108335
                            ],
                            "type": "scale"
                        },
                        {
                            "translation": [
                                0,
                                0,
                                1.2,
                                52.109135,
                                60.88427
                            ],
                            "type": "translation"
                        }
                    ],
                    "path": "0"
                },

Expected Behavior

The image should at least be viewable. Ideally, the translation should also be applied, to offset the image with respect to other images in the same coordinate system

Current Behavior

Fails to import. It seems that each coordinateTransformations item is expected to have a scale attribute:

Trying to explore https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr as OME NGFF Zarr v0.4...
Error when reading https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr as OME NGFF Zarr v0.4: Failed to read OME NGFF header at https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr/.zattrs <~ Failed to validate json against data schema <~ Validating Json Failed: {"obj.multiscales[0].datasets[0].coordinateTransformations[1].scale":[{"msg":["error.path.missing"],"args":[]}],"obj.multiscales[0].datasets[1].coordinateTransformations[1].scale":[{"msg":["error.path.missing"],"args":[]}],"obj.multiscales[0].datasets[2].coordinateTransformations[1].scale":[{"msg":["error.path.missing"],"args":[]}]}

Steps to Reproduce the bug

Try to import the image above

Your Environment for bug

  • Chrome
  • Version of WebKnossos (Release or Commit): 20071

will-moore avatar Nov 01 '22 13:11 will-moore

Thanks for the report! I can reproduce the behavior you describe.

I suggest we use this issue to track the actual support of using the translations in webKnossos. This is still blocked by internal discussions concerning our dataset coordinate systems and may take some time.

I created a second issue #6607 for only the “should at least be viewable” part, which should be pretty easy to solve.

fm3 avatar Nov 03 '22 18:11 fm3

For reference when this issue is scheduled in a sprint: Here is a very short discussion on this topic: https://scm.slack.com/archives/C5AKLAV0B/p1723014010079719

MichaelBuessemeyer avatar Aug 07 '24 12:08 MichaelBuessemeyer

The original issue is already fixed, since scale is now marked as optional, thus having a translation will not cause it to fail. The reason the dataset can currently not be opened is that the .zattrs of the label layer (0) use the wrong key "units" in multiscales/axes. Using the translation is not yet supported and can be tracked with this issue.

frcroth avatar Jan 06 '25 10:01 frcroth

on unit vs units, compare https://github.com/ome/ngff/issues/156 and https://github.com/ome/ngff/pull/157

However, looks like https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr/labels/.zattrs is correct :monocle_face: maybe we are looking at different files?

fm3 avatar Jan 06 '25 10:01 fm3

Just coming back to this again, I tried to open the image https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr and I'm seeing a different error now...

Maybe this should be a new issue?

Error when reading https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr as Neuroglancer URI Explorer: URI has no matching fragment part <~ Cannot invoke "String.length()" because "$this" is nulljava.lang.NullPointerException: Cannot invoke "String.length()" because "$this" is null
Error when reading https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr as Zarr v3 Array: failed to read zarr v3 header at https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr/zarr.json
Error when reading https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr as OME NGFF Zarr v0.5: Failed to read OME NGFF header at https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr/zarr.json
Error when reading https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr as N5 Multiscales with compact metadata: Failed to read N5 header at https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr/attributes.json
Error when reading https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr as N5 Multiscales: Failed to read N5 header at https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr/attributes.json
Error when reading https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr as Neuroglancer Precomputed: Failed to read neuroglancer precomputed metadata at https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr/info
Error when reading https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr as N5 Array: failed to read n5 header at https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr/attributes.json
Error when reading https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr as Zarr Array: failed to read zarr header at https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr/.zarray
Error when reading https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr as WEBKNOSSOS-based Zarr: Empty
Found 7 OME NGFF Zarr v0.4 layers at https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0101A/13457537.zarr.
Error when exploring as layer set: Could not extract common voxel size from layers <~ voxel sizes for layers are not uniform, got List(VoxelSize((0.108335, 0.108335, 0.4),micrometer), VoxelSize((0.108335, 0.108335, 0.4),micrometer), VoxelSize((0.108335, 0.108335, 0.4),micrometer), VoxelSize((0.108335, 0.108335, 0.4),micrometer), VoxelSize((0.108335, 0.108335, 0.4),micrometer), VoxelSize((0.108335, 0.108335, 0.4),micrometer), VoxelSize((0.108335, 0.108335, 0.4),nanometer)) <~ invalid mag: (2000, 2000, 1000). Must all be powers of two

will-moore avatar Apr 17 '25 14:04 will-moore

@will-moore Thanks for your report! I’m pretty sure I successfully imported that dataset at some point. Maybe some newer changes broke something. I wrote https://github.com/scalableminds/webknossos/issues/8544 to track that. I’m pretty sure it’s unrelated to translate properties. We’ll have a look!

fm3 avatar Apr 17 '25 14:04 fm3