From cf58377375e14f6d4c8be23f1b0f26b31f5fe7f0 Mon Sep 17 00:00:00 2001 From: Johannes Soltwedel <38459088+jo-mueller@users.noreply.github.com> Date: Wed, 17 Jun 2026 16:08:28 +0200 Subject: [PATCH] schema: better context-dependency layering --- schemas/coordinate_transformations.schema | 41 +++-------- schemas/scene.schema | 60 ++++++++--------- tests/attributes/spec/valid/scene/scene.json | 71 ++++++++++++++++++++ 3 files changed, 110 insertions(+), 62 deletions(-) create mode 100644 tests/attributes/spec/valid/scene/scene.json diff --git a/schemas/coordinate_transformations.schema b/schemas/coordinate_transformations.schema index 4138c300..093076d7 100644 --- a/schemas/coordinate_transformations.schema +++ b/schemas/coordinate_transformations.schema @@ -3,37 +3,7 @@ "$id": "https://ngff.openmicroscopy.org/0.6.dev4/schemas/coordinate_transformations.schema", "title": "Coordinate Transformations", "description": "OME-Zarr Coordinate transforms.", - "type": "array", - "uniqueItems": true, - "minItems": 1, - "items": { - "allOf": [ - { - "$ref": "#/$defs/coordinateTransformation" - }, - { - "type": "object", - "properties": { - "input": { - "allOf": [ - {"$ref": "#/$defs/inputOutput"}, - {"required": ["path"]} - ] - }, - "output": { - "allOf": [ - {"$ref": "#/$defs/inputOutput"}, - {"required": ["name"]} - ] - } - }, - "required": [ - "input", - "output" - ] - } - ] - }, + "$ref": "#/$defs/coordinateTransformations", "$defs": { "inputOutput": { "type": "object", @@ -42,6 +12,15 @@ "path": {"type": "string"} } }, + "coordinateTransformations": { + "description": "JSON array of multiple OME-ZARR transformations", + "type": "array", + "uniqueItems": true, + "minItems": 1, + "items": { + "$ref": "#/$defs/coordinateTransformation" + } + }, "coordinateTransformation": { "description": "OME-NGFF coordinate transformation.", "allOf": [ diff --git a/schemas/scene.schema b/schemas/scene.schema index 6c409a85..d13fe422 100644 --- a/schemas/scene.schema +++ b/schemas/scene.schema @@ -15,38 +15,36 @@ "description": "Coordinate systems to combine with transforms to define spatial relationships" }, "coordinateTransformations": { - "$comment": "Merge general coordinate transformations with constraints for scene metadata", - "allOf": [ - { - "$ref": "coordinate_transformations.schema", - "description": "General coordinate transformations defining spatial relationships between coordinate systems" - }, - { - "type": "array", - "items": { - "allOf": [ - { - "properties": { - "input": { - "allOf": [ - {"$ref": "coordinate_transformations.schema#/$defs/inputOutput"}, - {"required": ["name"]} - ] - }, - "output": { - "allOf": [ - {"$ref": "coordinate_transformations.schema#/$defs/inputOutput"}, - {"required": ["name"]} - ] - } - } - } - ] + "$comment": "Coordinate transformations defining spatial relationships between coordinate systems", + "type": "array", + "items": { + "allOf": [ + { + "$ref": "coordinate_transformations.schema#/$defs/coordinateTransformation" }, - "description": "Constrained input/output for coordinate transformations in scene metadata" - } - ] - + { + "type": "object", + "properties": { + "input": { + "allOf": [ + {"$ref": "coordinate_transformations.schema#/$defs/inputOutput"}, + {"required": ["name"]} + ] + }, + "output": { + "allOf": [ + {"$ref": "coordinate_transformations.schema#/$defs/inputOutput"}, + {"required": ["name"]} + ] + } + }, + "required": ["input", "output"] + } + ] + }, + "minItems": 1, + "uniqueItems": true, + "description": "Coordinate transformations defining spatial relationships between coordinate systems with scene-specific constraints" }, "arrayCoordinateSystem": { "type": "object", diff --git a/tests/attributes/spec/valid/scene/scene.json b/tests/attributes/spec/valid/scene/scene.json new file mode 100644 index 00000000..eae5a2de --- /dev/null +++ b/tests/attributes/spec/valid/scene/scene.json @@ -0,0 +1,71 @@ +{ + "ome": { + "version": "0.6.dev4", + "scene": { + "coordinateTransformations": [ + { + "input": {"path": "4995115_cropped_400_100_400_400_rot10.zarr", "name": "rotated"}, + "output": {"name": "translated_x50"}, + "name": "translate_tile_to_stitched_position", + "type": "translation", + "translation": [ + 0, + 0, + 30.608878192215265, + 11.21775638443053 + ] + }, + { + "input": {"path": "4995115_cropped_700_700_400_400_rot45.zarr", "name": "rotated"}, + "output": {"name": "translated_x50"}, + "name": "translate_tile_to_stitched_position", + "type": "translation", + "translation": [ + 0, + 0, + 91.8266345766458, + 41.8266345766458 + ] + }, + { + "input": {"name": "translated_x50"}, + "output": {"path": "4995115_full.zarr", "name": "physical"}, + "name": "translate_tile_to_stitched_position", + "type": "translation", + "translation": [ + 0, + 0, + 0, + 50 + ] + } + ], + "coordinateSystems": [ + { + "name": "translated_x50", + "axes": [ + { + "name": "c", + "type": "channel" + }, + { + "name": "z", + "type": "space", + "unit": "micrometer" + }, + { + "name": "y", + "type": "space", + "unit": "micrometer" + }, + { + "name": "x", + "type": "space", + "unit": "micrometer" + } + ] + } + ] + } + } +} \ No newline at end of file