From f07a613701153af4587e9af35a18b18b5da03582 Mon Sep 17 00:00:00 2001 From: William Moore Date: Fri, 28 Jan 2022 14:17:26 +0000 Subject: [PATCH 01/18] Add 0.4 schemas and examples --- .github/workflows/validation.yml | 1 + 0.4/examples/invalid/invalid_axes_count.json | 28 ++++ 0.4/examples/invalid/invalid_axis_type.json | 36 +++++ 0.4/examples/invalid/invalid_axis_units.json | 33 +++++ .../invalid/invalid_channels_color.json | 43 ++++++ .../invalid/invalid_channels_window.json | 43 ++++++ 0.4/examples/invalid/invalid_path.json | 29 ++++ 0.4/examples/invalid/invalid_version.json | 32 +++++ 0.4/examples/invalid/missing_axes.json | 14 ++ 0.4/examples/invalid/missing_datasets.json | 21 +++ 0.4/examples/invalid/missing_path.json | 29 ++++ 0.4/examples/invalid/no_axes.json | 15 +++ 0.4/examples/invalid/no_datasets.json | 15 +++ 0.4/examples/invalid/no_multiscales.json | 4 + 0.4/examples/valid/image.json | 43 ++++++ 0.4/examples/valid/image_metadata.json | 40 ++++++ 0.4/examples/valid/image_omero.json | 113 ++++++++++++++++ 0.4/examples/valid/missing_name.json | 37 ++++++ 0.4/examples/valid/missing_version.json | 25 ++++ 0.4/schemas/image.schema | 124 ++++++++++++++++++ 0.4/schemas/strict_image.schema | 18 +++ 0.4/tests/test_validation.py | 40 ++++++ 0.4/tox.ini | 10 ++ 23 files changed, 793 insertions(+) create mode 100644 0.4/examples/invalid/invalid_axes_count.json create mode 100644 0.4/examples/invalid/invalid_axis_type.json create mode 100644 0.4/examples/invalid/invalid_axis_units.json create mode 100644 0.4/examples/invalid/invalid_channels_color.json create mode 100644 0.4/examples/invalid/invalid_channels_window.json create mode 100644 0.4/examples/invalid/invalid_path.json create mode 100644 0.4/examples/invalid/invalid_version.json create mode 100644 0.4/examples/invalid/missing_axes.json create mode 100644 0.4/examples/invalid/missing_datasets.json create mode 100644 0.4/examples/invalid/missing_path.json create mode 100644 0.4/examples/invalid/no_axes.json create mode 100644 0.4/examples/invalid/no_datasets.json create mode 100644 0.4/examples/invalid/no_multiscales.json create mode 100644 0.4/examples/valid/image.json create mode 100644 0.4/examples/valid/image_metadata.json create mode 100644 0.4/examples/valid/image_omero.json create mode 100644 0.4/examples/valid/missing_name.json create mode 100644 0.4/examples/valid/missing_version.json create mode 100644 0.4/schemas/image.schema create mode 100644 0.4/schemas/strict_image.schema create mode 100644 0.4/tests/test_validation.py create mode 100644 0.4/tox.ini diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index a23bb72f..b56a3808 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -13,6 +13,7 @@ jobs: - '0.1' - '0.2' - '0.3' + - '0.4' runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 diff --git a/0.4/examples/invalid/invalid_axes_count.json b/0.4/examples/invalid/invalid_axes_count.json new file mode 100644 index 00000000..ffeefaeb --- /dev/null +++ b/0.4/examples/invalid/invalid_axes_count.json @@ -0,0 +1,28 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ], + "datasets": [ + { + "path": "0", + "transformations": [ + { + "scale": [ + 0.13, + 0.13 + ], + "type": "scale" + } + ] + } + ], + "version": "0.4" + } + ] +} \ No newline at end of file diff --git a/0.4/examples/invalid/invalid_axis_type.json b/0.4/examples/invalid/invalid_axis_type.json new file mode 100644 index 00000000..acb9c707 --- /dev/null +++ b/0.4/examples/invalid/invalid_axis_type.json @@ -0,0 +1,36 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "y", + "type": "invalid", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ], + "datasets": [ + { + "path": "0", + "transformations": [ + { + "scale": [ + 1, + 1, + 0.5, + 0.13, + 0.13 + ], + "type": "scale" + } + ] + } + ], + "version": "0.4" + } + ] +} diff --git a/0.4/examples/invalid/invalid_axis_units.json b/0.4/examples/invalid/invalid_axis_units.json new file mode 100644 index 00000000..48ece178 --- /dev/null +++ b/0.4/examples/invalid/invalid_axis_units.json @@ -0,0 +1,33 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "y", + "type": "space", + "units": "micron" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ], + "datasets": [ + { + "path": "0", + "transformations": [ + { + "scale": [ + 0.13, + 0.13 + ], + "type": "scale" + } + ] + } + ], + "version": "0.4" + } + ] +} \ No newline at end of file diff --git a/0.4/examples/invalid/invalid_channels_color.json b/0.4/examples/invalid/invalid_channels_color.json new file mode 100644 index 00000000..7410cc2d --- /dev/null +++ b/0.4/examples/invalid/invalid_channels_color.json @@ -0,0 +1,43 @@ +{ + "@type": "ngff:Image", + "multiscales": [ + { + "version": "0.4", + "name": "example", + "datasets": [ + { + "path": "path/to/0" + } + ], + "axes": [ + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ] + } + ], + "omero": { + "channels": [ + { + "active": true, + "coefficient": 1.0, + "color": 255, + "family": "linear", + "label": "1234", + "window": { + "end": 1765.0, + "max": 2555.0, + "min": 5.0, + "start": 0.0 + } + } + ] + } +} diff --git a/0.4/examples/invalid/invalid_channels_window.json b/0.4/examples/invalid/invalid_channels_window.json new file mode 100644 index 00000000..d97943a7 --- /dev/null +++ b/0.4/examples/invalid/invalid_channels_window.json @@ -0,0 +1,43 @@ +{ + "@type": "ngff:Image", + "multiscales": [ + { + "version": "0.4", + "name": "example", + "datasets": [ + { + "path": "path/to/0" + } + ], + "axes": [ + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ] + } + ], + "omero": { + "channels": [ + { + "active": true, + "coefficient": 1.0, + "color": "ff0000", + "family": "linear", + "label": "1234", + "window": { + "end": "100", + "max": 2555.0, + "min": 5.0, + "start": 0.0 + } + } + ] + } +} diff --git a/0.4/examples/invalid/invalid_path.json b/0.4/examples/invalid/invalid_path.json new file mode 100644 index 00000000..de173916 --- /dev/null +++ b/0.4/examples/invalid/invalid_path.json @@ -0,0 +1,29 @@ +{ + "@type": "ngff:Image", + "multiscales": [ + { + "version": "0.4", + "name": "example", + "datasets": [ + { + "path": "path/to/0" + }, + { + "path": 0 + } + ], + "axes": [ + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ] + } + ] +} diff --git a/0.4/examples/invalid/invalid_version.json b/0.4/examples/invalid/invalid_version.json new file mode 100644 index 00000000..f500419a --- /dev/null +++ b/0.4/examples/invalid/invalid_version.json @@ -0,0 +1,32 @@ +{ + "@type": "ngff:Image", + "multiscales": [ + { + "version": "invalid", + "name": "example", + "datasets": [ + { + "path": "path/to/0" + }, + { + "path": "1" + }, + { + "path": "2" + } + ], + "axes": [ + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ] + } + ] +} \ No newline at end of file diff --git a/0.4/examples/invalid/missing_axes.json b/0.4/examples/invalid/missing_axes.json new file mode 100644 index 00000000..aa42858a --- /dev/null +++ b/0.4/examples/invalid/missing_axes.json @@ -0,0 +1,14 @@ +{ + "@type": "ngff:Image", + "multiscales": [ + { + "version": "0.4", + "name": "example", + "datasets": [ + { + "path": "path/to/0" + } + ] + } + ] +} \ No newline at end of file diff --git a/0.4/examples/invalid/missing_datasets.json b/0.4/examples/invalid/missing_datasets.json new file mode 100644 index 00000000..59dbfebe --- /dev/null +++ b/0.4/examples/invalid/missing_datasets.json @@ -0,0 +1,21 @@ +{ + "@type": "ngff:Image", + "multiscales": [ + { + "version": "0.4", + "name": "example", + "axes": [ + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ] + } + ] +} diff --git a/0.4/examples/invalid/missing_path.json b/0.4/examples/invalid/missing_path.json new file mode 100644 index 00000000..57722de9 --- /dev/null +++ b/0.4/examples/invalid/missing_path.json @@ -0,0 +1,29 @@ +{ + "@type": "ngff:Image", + "multiscales": [ + { + "version": "0.4", + "name": "example", + "datasets": [ + { + "foo": "path/to/0" + }, + { + "path": "1" + } + ], + "axes": [ + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ] + } + ] +} diff --git a/0.4/examples/invalid/no_axes.json b/0.4/examples/invalid/no_axes.json new file mode 100644 index 00000000..94017c71 --- /dev/null +++ b/0.4/examples/invalid/no_axes.json @@ -0,0 +1,15 @@ +{ + "@type": "ngff:Image", + "multiscales": [ + { + "version": "0.4", + "name": "example", + "datasets": [ + { + "path": "path/to/0" + } + ], + "axes": [] + } + ] +} diff --git a/0.4/examples/invalid/no_datasets.json b/0.4/examples/invalid/no_datasets.json new file mode 100644 index 00000000..31537f03 --- /dev/null +++ b/0.4/examples/invalid/no_datasets.json @@ -0,0 +1,15 @@ +{ + "@type": "ngff:Image", + "multiscales": [ + { + "version": "0.3", + "name": "example", + "datasets": [], + "axes": [ + "z", + "y", + "x" + ] + } + ] +} diff --git a/0.4/examples/invalid/no_multiscales.json b/0.4/examples/invalid/no_multiscales.json new file mode 100644 index 00000000..d6dbfb33 --- /dev/null +++ b/0.4/examples/invalid/no_multiscales.json @@ -0,0 +1,4 @@ +{ + "@type": "ngff:Image", + "multiscales": [] +} diff --git a/0.4/examples/valid/image.json b/0.4/examples/valid/image.json new file mode 100644 index 00000000..b412d298 --- /dev/null +++ b/0.4/examples/valid/image.json @@ -0,0 +1,43 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "t", + "type": "time" + }, + { + "name": "c", + "type": "channel" + }, + { + "name": "z", + "type": "space", + "units": "micrometer" + }, + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ], + "datasets": [ + { + "path": "0", + "transformations": [ + { + "scale": [1, 1, 0.5, 0.13, 0.13], + "type": "scale" + } + ] + } + ], + "version": "0.4" + } + ] +} \ No newline at end of file diff --git a/0.4/examples/valid/image_metadata.json b/0.4/examples/valid/image_metadata.json new file mode 100644 index 00000000..4db8cec7 --- /dev/null +++ b/0.4/examples/valid/image_metadata.json @@ -0,0 +1,40 @@ +{ + "@id": "top", + "@type": "ngff:Image", + "multiscales": [ + { + "@id": "inner", + "version": "0.4", + "name": "example", + "datasets": [ + { + "path": "path/to/0" + } + ], + "type": "gaussian", + "metadata": { + "method": "skimage.transform.pyramid_gaussian", + "version": "0.16.1", + "args": [ + "true", + "false" + ], + "kwargs": { + "multichannel": true + } + }, + "axes": [ + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ] + } + ] +} diff --git a/0.4/examples/valid/image_omero.json b/0.4/examples/valid/image_omero.json new file mode 100644 index 00000000..287c923f --- /dev/null +++ b/0.4/examples/valid/image_omero.json @@ -0,0 +1,113 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "t", + "type": "time" + }, + { + "name": "c", + "type": "channel" + }, + { + "name": "z", + "type": "space", + "units": "micrometer" + }, + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ], + "datasets": [ + { + "path": "0", + "transformations": [ + { + "scale": [ + 1, + 1, + 0.5, + 0.13, + 0.13 + ], + "type": "scale" + }, + { + "translation": [ + 0, + 9, + 0.5, + 25.74, + 21.58 + ], + "type": "translation" + } + ] + }, + { + "path": "1", + "transformations": [ + { + "scale": [ + 1, + 1, + 1, + 0.26, + 0.26 + ], + "type": "scale" + } + ] + } + ], + "version": "0.4" + } + ], + "omero": { + "channels": [ + { + "active": true, + "coefficient": 1.0, + "color": "00FF00", + "family": "linear", + "inverted": false, + "label": "FITC", + "window": { + "end": 813.0, + "max": 870.0, + "min": 102.0, + "start": 82.0 + } + }, + { + "active": true, + "coefficient": 1.0, + "color": "FF0000", + "family": "linear", + "inverted": false, + "label": "RD-TR-PE", + "window": { + "end": 815.0, + "max": 441.0, + "min": 129.0, + "start": 78.0 + } + } + ], + "id": 1, + "rdefs": { + "defaultT": 0, + "defaultZ": 2, + "model": "color" + }, + "version": "0.4" + } +} \ No newline at end of file diff --git a/0.4/examples/valid/missing_name.json b/0.4/examples/valid/missing_name.json new file mode 100644 index 00000000..87febae4 --- /dev/null +++ b/0.4/examples/valid/missing_name.json @@ -0,0 +1,37 @@ +{ + "@type": "ngff:Image", + "multiscales": [ + { + "version": "0.4", + "datasets": [ + { + "path": "path/to/0" + } + ], + "type": "gaussian", + "metadata": { + "method": "skimage.transform.pyramid_gaussian", + "version": "0.16.1", + "args": [ + "true", + "false" + ], + "kwargs": { + "multichannel": true + } + }, + "axes": [ + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ] + } + ] +} diff --git a/0.4/examples/valid/missing_version.json b/0.4/examples/valid/missing_version.json new file mode 100644 index 00000000..6b28c98e --- /dev/null +++ b/0.4/examples/valid/missing_version.json @@ -0,0 +1,25 @@ +{ + "@type": "ngff:Image", + "multiscales": [ + { + "name": "example", + "datasets": [ + { + "path": "path/to/0" + } + ], + "axes": [ + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ] + } + ] +} diff --git a/0.4/schemas/image.schema b/0.4/schemas/image.schema new file mode 100644 index 00000000..9b6a29a1 --- /dev/null +++ b/0.4/schemas/image.schema @@ -0,0 +1,124 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://ngff.openmicroscopy.org/0.3/schemas/image.schema", + "title": "NGFF Image", + "description": "JSON from OME-NGFF .zattrs", + "type": "object", + "properties": { + "multiscales": { + "description": "The multiscale datasets for this image", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "datasets": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "path": { + "type": "string" + } + }, + "required": ["path"] + } + }, + "version": { + "type": "string", + "enum": [ + "0.4" + ] + }, + "axes": { + "type": "array", + "minItems": 2, + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "enum": ["space", "time", "channel"] + }, + "units": { + "type": "string", + "enum": [ + "angstrom", "attometer", "centimeter", "decimeter", "exameter", "femtometer", "foot", "gigameter", "hectometer", "inch", "kilometer", "megameter", "meter", "micrometer", "mile", "millimeter", "nanometer", "parsec", "petameter", "picometer", "terameter", "yard", "yoctometer", "yottameter", "zeptometer", "zettameter" + ] + } + }, + "required": ["name", "type"] + } + } + }, + "required": [ + "datasets", "axes" + ] + }, + "minItems": 1, + "uniqueItems": true + }, + "omero": { + "type": "object", + "properties": { + "channels": { + "type": "array", + "items": { + "type": "object", + "properties": { + "window": { + "type": "object", + "properties": { + "end": { + "type": "number" + }, + "max": { + "type": "number" + }, + "min": { + "type": "number" + }, + "start": { + "type": "number" + } + }, + "required": [ + "start", + "min", + "end", + "max" + ] + }, + "label": { + "type": "string" + }, + "family": { + "type": "string" + }, + "color": { + "type": "string" + }, + "active": { + "type": "boolean" + } + }, + "required": [ + "window", + "color" + ] + } + } + }, + "required": [ + "channels" + ] + } + }, + "required": [ "multiscales" ] +} diff --git a/0.4/schemas/strict_image.schema b/0.4/schemas/strict_image.schema new file mode 100644 index 00000000..d3758444 --- /dev/null +++ b/0.4/schemas/strict_image.schema @@ -0,0 +1,18 @@ +{ + "allOf": [ + { + "$ref": "https://ngff.openmicroscopy.org/0.3/schemas/image.schema" + }, + { + "properties": { + "multiscales": { + "items": { + "required": [ + "version", "metadata", "type", "name" + ] + } + } + } + } + ] +} \ No newline at end of file diff --git a/0.4/tests/test_validation.py b/0.4/tests/test_validation.py new file mode 100644 index 00000000..48a3c4ed --- /dev/null +++ b/0.4/tests/test_validation.py @@ -0,0 +1,40 @@ +import json +import glob + +import pytest + +from jsonschema import validate +from jsonschema.exceptions import ValidationError + + +def files(): + return list(glob.glob(f"examples/valid/*.json")) + \ + list(glob.glob(f"examples/invalid/*.json")) + +def ids(): + return [str(x).split("/")[-1][0:-5] for x in files()] + + +@pytest.mark.parametrize("testfile", files(), ids=ids()) +def test_json(testfile): + + if "invalid" in testfile: + with pytest.raises(ValidationError): + json_schema(testfile) + else: + json_schema(testfile) + + +def json_schema(path): + # Load the correct schema + with open(path) as f: + test_json = json.loads(f.read()) + # we don't have @type in this version + if "multiscales" in test_json: + schema_name = "image.schema" + else: + raise Exception("No schema found") + + with open('schemas/' + schema_name) as f: + schema = json.loads(f.read()) + validate(instance=test_json, schema=schema) diff --git a/0.4/tox.ini b/0.4/tox.ini new file mode 100644 index 00000000..632ca64e --- /dev/null +++ b/0.4/tox.ini @@ -0,0 +1,10 @@ +[tox] +envlist = v04 +skipsdist = True + +[testenv] +deps = + pytest + jsonschema +commands = + pytest tests --color=yes --basetemp={envtmpdir} {posargs:-v} \ No newline at end of file From 1f584b02a1f5dba9cc847786bcaba215462cb8c6 Mon Sep 17 00:00:00 2001 From: William Moore Date: Fri, 28 Jan 2022 15:00:04 +0000 Subject: [PATCH 02/18] ensure 'time' and 'space' axes have valid units --- 0.4/examples/invalid/mismatch_axes_units.json | 38 +++++++++++ 0.4/examples/valid/image.json | 3 +- 0.4/schemas/image.schema | 64 +++++++++++++++---- 3 files changed, 90 insertions(+), 15 deletions(-) create mode 100644 0.4/examples/invalid/mismatch_axes_units.json diff --git a/0.4/examples/invalid/mismatch_axes_units.json b/0.4/examples/invalid/mismatch_axes_units.json new file mode 100644 index 00000000..ec6ad89b --- /dev/null +++ b/0.4/examples/invalid/mismatch_axes_units.json @@ -0,0 +1,38 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "t", + "type": "time", + "units": "micrometer" + }, + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ], + "datasets": [ + { + "path": "0", + "transformations": [ + { + "scale": [ + 0.13, + 0.13 + ], + "type": "scale" + } + ] + } + ], + "version": "0.4" + } + ] +} \ No newline at end of file diff --git a/0.4/examples/valid/image.json b/0.4/examples/valid/image.json index b412d298..87bdecea 100644 --- a/0.4/examples/valid/image.json +++ b/0.4/examples/valid/image.json @@ -4,7 +4,8 @@ "axes": [ { "name": "t", - "type": "time" + "type": "time", + "units": "second" }, { "name": "c", diff --git a/0.4/schemas/image.schema b/0.4/schemas/image.schema index 9b6a29a1..e96afbce 100644 --- a/0.4/schemas/image.schema +++ b/0.4/schemas/image.schema @@ -37,23 +37,59 @@ "type": "array", "minItems": 2, "items": { - "type": "object", - "properties": { - "name": { - "type": "string" + "oneOf": [ + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "enum": ["space"] + }, + "units": { + "type": "string", + "enum": [ + "angstrom", "attometer", "centimeter", "decimeter", "exameter", "femtometer", "foot", "gigameter", "hectometer", "inch", "kilometer", "megameter", "meter", "micrometer", "mile", "millimeter", "nanometer", "parsec", "petameter", "picometer", "terameter", "yard", "yoctometer", "yottameter", "zeptometer", "zettameter" + ] + } + }, + "required": ["name", "type"] }, - "type": { - "type": "string", - "enum": ["space", "time", "channel"] + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "enum": ["time"] + }, + "units": { + "type": "string", + "enum": [ + "attosecond", "centisecond", "day", "decisecond", "exasecond", "femtosecond", "gigasecond", "hectosecond", "hour", "kilosecond", "megasecond", "microsecond", "millisecond", "minute", "nanosecond", "petasecond", "picosecond", "second", "terasecond", "yoctosecond", "yottasecond", "zeptosecond", "zettasecond" + ] + } + }, + "required": ["name", "type"] }, - "units": { - "type": "string", - "enum": [ - "angstrom", "attometer", "centimeter", "decimeter", "exameter", "femtometer", "foot", "gigameter", "hectometer", "inch", "kilometer", "megameter", "meter", "micrometer", "mile", "millimeter", "nanometer", "parsec", "petameter", "picometer", "terameter", "yard", "yoctometer", "yottameter", "zeptometer", "zettameter" - ] + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "enum": ["channel"] + } + }, + "required": ["name", "type"] } - }, - "required": ["name", "type"] + ] } } }, From 78b169881b019e98b50606a47532091b7d2fc7a1 Mon Sep 17 00:00:00 2001 From: William Moore Date: Fri, 28 Jan 2022 16:36:22 +0000 Subject: [PATCH 03/18] Require 'scale' or 'translation' transformation(s) --- .../invalid/empty_transformations.json | 25 ++++++++++ 0.4/examples/invalid/invalid_axes_count.json | 6 +-- 0.4/examples/invalid/invalid_axis_type.json | 5 +- .../invalid/invalid_channels_color.json | 22 +++++---- .../invalid/invalid_channels_window.json | 25 ++++++---- 0.4/examples/invalid/invalid_path.json | 28 ++++++----- .../invalid/invalid_transformation_type.json | 33 +++++++++++++ 0.4/examples/invalid/invalid_version.json | 31 ++++++------ 0.4/examples/invalid/missing_axes.json | 17 +++++-- 0.4/examples/invalid/missing_datasets.json | 6 +-- 0.4/examples/invalid/missing_path.json | 27 ++++++----- .../invalid/missing_transformations.json | 24 ++++++++++ 0.4/examples/invalid/no_axes.json | 17 +++++-- 0.4/examples/invalid/no_datasets.json | 21 ++++---- 0.4/examples/valid/image.json | 16 +------ 0.4/examples/valid/image_metadata.json | 8 +++- 0.4/examples/valid/missing_name.json | 8 +++- 0.4/examples/valid/missing_version.json | 8 +++- 0.4/schemas/image.schema | 48 ++++++++++++++++++- 19 files changed, 270 insertions(+), 105 deletions(-) create mode 100644 0.4/examples/invalid/empty_transformations.json create mode 100644 0.4/examples/invalid/invalid_transformation_type.json create mode 100644 0.4/examples/invalid/missing_transformations.json diff --git a/0.4/examples/invalid/empty_transformations.json b/0.4/examples/invalid/empty_transformations.json new file mode 100644 index 00000000..4516500c --- /dev/null +++ b/0.4/examples/invalid/empty_transformations.json @@ -0,0 +1,25 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ], + "datasets": [ + { + "path": "0", + "transformations": [] + } + ], + "version": "0.4" + } + ] +} \ No newline at end of file diff --git a/0.4/examples/invalid/invalid_axes_count.json b/0.4/examples/invalid/invalid_axes_count.json index ffeefaeb..b748d68b 100644 --- a/0.4/examples/invalid/invalid_axes_count.json +++ b/0.4/examples/invalid/invalid_axes_count.json @@ -3,7 +3,7 @@ { "axes": [ { - "name": "x", + "name": "y", "type": "space", "units": "micrometer" } @@ -14,8 +14,8 @@ "transformations": [ { "scale": [ - 0.13, - 0.13 + 1, + 1 ], "type": "scale" } diff --git a/0.4/examples/invalid/invalid_axis_type.json b/0.4/examples/invalid/invalid_axis_type.json index acb9c707..3b9f0b1b 100644 --- a/0.4/examples/invalid/invalid_axis_type.json +++ b/0.4/examples/invalid/invalid_axis_type.json @@ -20,10 +20,7 @@ { "scale": [ 1, - 1, - 0.5, - 0.13, - 0.13 + 1 ], "type": "scale" } diff --git a/0.4/examples/invalid/invalid_channels_color.json b/0.4/examples/invalid/invalid_channels_color.json index 7410cc2d..736dd571 100644 --- a/0.4/examples/invalid/invalid_channels_color.json +++ b/0.4/examples/invalid/invalid_channels_color.json @@ -1,14 +1,6 @@ { - "@type": "ngff:Image", "multiscales": [ { - "version": "0.4", - "name": "example", - "datasets": [ - { - "path": "path/to/0" - } - ], "axes": [ { "name": "y", @@ -20,7 +12,19 @@ "type": "space", "units": "micrometer" } - ] + ], + "datasets": [ + { + "path": "0", + "transformations": [ + { + "scale": [1, 1], + "type": "scale" + } + ] + } + ], + "version": "0.4" } ], "omero": { diff --git a/0.4/examples/invalid/invalid_channels_window.json b/0.4/examples/invalid/invalid_channels_window.json index d97943a7..47e91382 100644 --- a/0.4/examples/invalid/invalid_channels_window.json +++ b/0.4/examples/invalid/invalid_channels_window.json @@ -1,14 +1,6 @@ { - "@type": "ngff:Image", "multiscales": [ { - "version": "0.4", - "name": "example", - "datasets": [ - { - "path": "path/to/0" - } - ], "axes": [ { "name": "y", @@ -20,7 +12,22 @@ "type": "space", "units": "micrometer" } - ] + ], + "datasets": [ + { + "path": "0", + "transformations": [ + { + "scale": [ + 1, + 1 + ], + "type": "scale" + } + ] + } + ], + "version": "0.4" } ], "omero": { diff --git a/0.4/examples/invalid/invalid_path.json b/0.4/examples/invalid/invalid_path.json index de173916..64bc142d 100644 --- a/0.4/examples/invalid/invalid_path.json +++ b/0.4/examples/invalid/invalid_path.json @@ -1,17 +1,6 @@ { - "@type": "ngff:Image", "multiscales": [ { - "version": "0.4", - "name": "example", - "datasets": [ - { - "path": "path/to/0" - }, - { - "path": 0 - } - ], "axes": [ { "name": "y", @@ -23,7 +12,22 @@ "type": "space", "units": "micrometer" } - ] + ], + "datasets": [ + { + "path": 0, + "transformations": [ + { + "scale": [ + 1, + 1 + ], + "type": "scale" + } + ] + } + ], + "version": "0.4" } ] } diff --git a/0.4/examples/invalid/invalid_transformation_type.json b/0.4/examples/invalid/invalid_transformation_type.json new file mode 100644 index 00000000..50386447 --- /dev/null +++ b/0.4/examples/invalid/invalid_transformation_type.json @@ -0,0 +1,33 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ], + "datasets": [ + { + "path": "0", + "transformations": [ + { + "scale": [ + 1, + 1 + ], + "type": "translation" + } + ] + } + ], + "version": "0.4" + } + ] +} \ No newline at end of file diff --git a/0.4/examples/invalid/invalid_version.json b/0.4/examples/invalid/invalid_version.json index f500419a..6e96ea88 100644 --- a/0.4/examples/invalid/invalid_version.json +++ b/0.4/examples/invalid/invalid_version.json @@ -1,20 +1,6 @@ { - "@type": "ngff:Image", "multiscales": [ { - "version": "invalid", - "name": "example", - "datasets": [ - { - "path": "path/to/0" - }, - { - "path": "1" - }, - { - "path": "2" - } - ], "axes": [ { "name": "y", @@ -26,7 +12,22 @@ "type": "space", "units": "micrometer" } - ] + ], + "datasets": [ + { + "path": "0", + "transformations": [ + { + "scale": [ + 1, + 1 + ], + "type": "scale" + } + ] + } + ], + "version": "0.3" } ] } \ No newline at end of file diff --git a/0.4/examples/invalid/missing_axes.json b/0.4/examples/invalid/missing_axes.json index aa42858a..ddd83c19 100644 --- a/0.4/examples/invalid/missing_axes.json +++ b/0.4/examples/invalid/missing_axes.json @@ -1,14 +1,21 @@ { - "@type": "ngff:Image", "multiscales": [ { - "version": "0.4", - "name": "example", "datasets": [ { - "path": "path/to/0" + "path": "0", + "transformations": [ + { + "scale": [ + 1, + 1 + ], + "type": "scale" + } + ] } - ] + ], + "version": "0.4" } ] } \ No newline at end of file diff --git a/0.4/examples/invalid/missing_datasets.json b/0.4/examples/invalid/missing_datasets.json index 59dbfebe..d95a776c 100644 --- a/0.4/examples/invalid/missing_datasets.json +++ b/0.4/examples/invalid/missing_datasets.json @@ -1,9 +1,6 @@ { - "@type": "ngff:Image", "multiscales": [ { - "version": "0.4", - "name": "example", "axes": [ { "name": "y", @@ -15,7 +12,8 @@ "type": "space", "units": "micrometer" } - ] + ], + "version": "0.4" } ] } diff --git a/0.4/examples/invalid/missing_path.json b/0.4/examples/invalid/missing_path.json index 57722de9..b4a706a6 100644 --- a/0.4/examples/invalid/missing_path.json +++ b/0.4/examples/invalid/missing_path.json @@ -1,17 +1,6 @@ { - "@type": "ngff:Image", "multiscales": [ { - "version": "0.4", - "name": "example", - "datasets": [ - { - "foo": "path/to/0" - }, - { - "path": "1" - } - ], "axes": [ { "name": "y", @@ -23,7 +12,21 @@ "type": "space", "units": "micrometer" } - ] + ], + "datasets": [ + { + "transformations": [ + { + "scale": [ + 1, + 1 + ], + "type": "scale" + } + ] + } + ], + "version": "0.4" } ] } diff --git a/0.4/examples/invalid/missing_transformations.json b/0.4/examples/invalid/missing_transformations.json new file mode 100644 index 00000000..4c97cedc --- /dev/null +++ b/0.4/examples/invalid/missing_transformations.json @@ -0,0 +1,24 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ], + "datasets": [ + { + "path": "0" + } + ], + "version": "0.4" + } + ] +} \ No newline at end of file diff --git a/0.4/examples/invalid/no_axes.json b/0.4/examples/invalid/no_axes.json index 94017c71..a1f26d94 100644 --- a/0.4/examples/invalid/no_axes.json +++ b/0.4/examples/invalid/no_axes.json @@ -1,15 +1,22 @@ { - "@type": "ngff:Image", "multiscales": [ { - "version": "0.4", - "name": "example", + "axes": [], "datasets": [ { - "path": "path/to/0" + "path": "0", + "transformations": [ + { + "scale": [ + 1, + 1 + ], + "type": "scale" + } + ] } ], - "axes": [] + "version": "0.4" } ] } diff --git a/0.4/examples/invalid/no_datasets.json b/0.4/examples/invalid/no_datasets.json index 31537f03..add3f0eb 100644 --- a/0.4/examples/invalid/no_datasets.json +++ b/0.4/examples/invalid/no_datasets.json @@ -1,15 +1,20 @@ { - "@type": "ngff:Image", "multiscales": [ { - "version": "0.3", - "name": "example", - "datasets": [], "axes": [ - "z", - "y", - "x" - ] + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ], + "datasets": [], + "version": "0.4" } ] } diff --git a/0.4/examples/valid/image.json b/0.4/examples/valid/image.json index 87bdecea..ba517763 100644 --- a/0.4/examples/valid/image.json +++ b/0.4/examples/valid/image.json @@ -2,20 +2,6 @@ "multiscales": [ { "axes": [ - { - "name": "t", - "type": "time", - "units": "second" - }, - { - "name": "c", - "type": "channel" - }, - { - "name": "z", - "type": "space", - "units": "micrometer" - }, { "name": "y", "type": "space", @@ -32,7 +18,7 @@ "path": "0", "transformations": [ { - "scale": [1, 1, 0.5, 0.13, 0.13], + "scale": [1, 1], "type": "scale" } ] diff --git a/0.4/examples/valid/image_metadata.json b/0.4/examples/valid/image_metadata.json index 4db8cec7..6d069ebe 100644 --- a/0.4/examples/valid/image_metadata.json +++ b/0.4/examples/valid/image_metadata.json @@ -8,7 +8,13 @@ "name": "example", "datasets": [ { - "path": "path/to/0" + "path": "path/to/0", + "transformations": [ + { + "type": "scale", + "scale": [1, 1] + } + ] } ], "type": "gaussian", diff --git a/0.4/examples/valid/missing_name.json b/0.4/examples/valid/missing_name.json index 87febae4..dbb5b515 100644 --- a/0.4/examples/valid/missing_name.json +++ b/0.4/examples/valid/missing_name.json @@ -5,7 +5,13 @@ "version": "0.4", "datasets": [ { - "path": "path/to/0" + "path": "path/to/0", + "transformations": [ + { + "type": "scale", + "scale": [1, 1] + } + ] } ], "type": "gaussian", diff --git a/0.4/examples/valid/missing_version.json b/0.4/examples/valid/missing_version.json index 6b28c98e..7a2cb6d5 100644 --- a/0.4/examples/valid/missing_version.json +++ b/0.4/examples/valid/missing_version.json @@ -5,7 +5,13 @@ "name": "example", "datasets": [ { - "path": "path/to/0" + "path": "path/to/0", + "transformations": [ + { + "type": "scale", + "scale": [1, 1] + } + ] } ], "axes": [ diff --git a/0.4/schemas/image.schema b/0.4/schemas/image.schema index e96afbce..84858c39 100644 --- a/0.4/schemas/image.schema +++ b/0.4/schemas/image.schema @@ -22,9 +22,55 @@ "properties": { "path": { "type": "string" + }, + "transformations": { + "type": "array", + "minItems": 1, + "items": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "scale" + ] + }, + "scale": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + }, + "required": ["type", "scale"] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "translation" + ] + }, + "translation": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + }, + "required": ["type", "translation"] + } + ] + } } }, - "required": ["path"] + "required": ["path", "transformations"] } }, "version": { From e92b6ef18cc428ca75d89cf1f6e19dad95396746 Mon Sep 17 00:00:00 2001 From: William Moore Date: Fri, 28 Jan 2022 16:53:07 +0000 Subject: [PATCH 04/18] Add new-lines to end of json examples --- 0.4/examples/invalid/empty_transformations.json | 2 +- 0.4/examples/invalid/invalid_axes_count.json | 2 +- 0.4/examples/invalid/invalid_axis_units.json | 2 +- 0.4/examples/invalid/invalid_channels_color.json | 1 + 0.4/examples/invalid/invalid_transformation_type.json | 2 +- 0.4/examples/invalid/invalid_version.json | 2 +- 0.4/examples/invalid/mismatch_axes_units.json | 2 +- 0.4/examples/invalid/missing_axes.json | 2 +- 0.4/examples/invalid/missing_datasets.json | 1 + 0.4/examples/invalid/missing_transformations.json | 2 +- 0.4/examples/invalid/no_axes.json | 1 + 0.4/examples/valid/image_omero.json | 2 +- 12 files changed, 12 insertions(+), 9 deletions(-) diff --git a/0.4/examples/invalid/empty_transformations.json b/0.4/examples/invalid/empty_transformations.json index 4516500c..86abc9aa 100644 --- a/0.4/examples/invalid/empty_transformations.json +++ b/0.4/examples/invalid/empty_transformations.json @@ -22,4 +22,4 @@ "version": "0.4" } ] -} \ No newline at end of file +} diff --git a/0.4/examples/invalid/invalid_axes_count.json b/0.4/examples/invalid/invalid_axes_count.json index b748d68b..35ad59d0 100644 --- a/0.4/examples/invalid/invalid_axes_count.json +++ b/0.4/examples/invalid/invalid_axes_count.json @@ -25,4 +25,4 @@ "version": "0.4" } ] -} \ No newline at end of file +} diff --git a/0.4/examples/invalid/invalid_axis_units.json b/0.4/examples/invalid/invalid_axis_units.json index 48ece178..7aef1264 100644 --- a/0.4/examples/invalid/invalid_axis_units.json +++ b/0.4/examples/invalid/invalid_axis_units.json @@ -30,4 +30,4 @@ "version": "0.4" } ] -} \ No newline at end of file +} diff --git a/0.4/examples/invalid/invalid_channels_color.json b/0.4/examples/invalid/invalid_channels_color.json index 736dd571..2fe0f8e5 100644 --- a/0.4/examples/invalid/invalid_channels_color.json +++ b/0.4/examples/invalid/invalid_channels_color.json @@ -45,3 +45,4 @@ ] } } + diff --git a/0.4/examples/invalid/invalid_transformation_type.json b/0.4/examples/invalid/invalid_transformation_type.json index 50386447..11db7c00 100644 --- a/0.4/examples/invalid/invalid_transformation_type.json +++ b/0.4/examples/invalid/invalid_transformation_type.json @@ -30,4 +30,4 @@ "version": "0.4" } ] -} \ No newline at end of file +} diff --git a/0.4/examples/invalid/invalid_version.json b/0.4/examples/invalid/invalid_version.json index 6e96ea88..2cb38e8c 100644 --- a/0.4/examples/invalid/invalid_version.json +++ b/0.4/examples/invalid/invalid_version.json @@ -30,4 +30,4 @@ "version": "0.3" } ] -} \ No newline at end of file +} diff --git a/0.4/examples/invalid/mismatch_axes_units.json b/0.4/examples/invalid/mismatch_axes_units.json index ec6ad89b..ed2d71de 100644 --- a/0.4/examples/invalid/mismatch_axes_units.json +++ b/0.4/examples/invalid/mismatch_axes_units.json @@ -35,4 +35,4 @@ "version": "0.4" } ] -} \ No newline at end of file +} diff --git a/0.4/examples/invalid/missing_axes.json b/0.4/examples/invalid/missing_axes.json index ddd83c19..01c0953b 100644 --- a/0.4/examples/invalid/missing_axes.json +++ b/0.4/examples/invalid/missing_axes.json @@ -18,4 +18,4 @@ "version": "0.4" } ] -} \ No newline at end of file +} diff --git a/0.4/examples/invalid/missing_datasets.json b/0.4/examples/invalid/missing_datasets.json index d95a776c..21b81ba9 100644 --- a/0.4/examples/invalid/missing_datasets.json +++ b/0.4/examples/invalid/missing_datasets.json @@ -17,3 +17,4 @@ } ] } + diff --git a/0.4/examples/invalid/missing_transformations.json b/0.4/examples/invalid/missing_transformations.json index 4c97cedc..85fbdc1c 100644 --- a/0.4/examples/invalid/missing_transformations.json +++ b/0.4/examples/invalid/missing_transformations.json @@ -21,4 +21,4 @@ "version": "0.4" } ] -} \ No newline at end of file +} diff --git a/0.4/examples/invalid/no_axes.json b/0.4/examples/invalid/no_axes.json index a1f26d94..610bc6fb 100644 --- a/0.4/examples/invalid/no_axes.json +++ b/0.4/examples/invalid/no_axes.json @@ -20,3 +20,4 @@ } ] } + diff --git a/0.4/examples/valid/image_omero.json b/0.4/examples/valid/image_omero.json index 287c923f..4c89e92e 100644 --- a/0.4/examples/valid/image_omero.json +++ b/0.4/examples/valid/image_omero.json @@ -110,4 +110,4 @@ }, "version": "0.4" } -} \ No newline at end of file +} From a4346690f81ad1aeb2449237db18a46174e95e94 Mon Sep 17 00:00:00 2001 From: William Moore Date: Mon, 31 Jan 2022 11:24:03 +0000 Subject: [PATCH 05/18] Rename to coordinateTransforms --- 0.4/examples/invalid/empty_transformations.json | 2 +- 0.4/examples/invalid/invalid_axes_count.json | 2 +- 0.4/examples/invalid/invalid_axis_type.json | 2 +- 0.4/examples/invalid/invalid_axis_units.json | 2 +- 0.4/examples/invalid/invalid_channels_color.json | 2 +- 0.4/examples/invalid/invalid_channels_window.json | 2 +- 0.4/examples/invalid/invalid_path.json | 2 +- 0.4/examples/invalid/invalid_transformation_type.json | 2 +- 0.4/examples/invalid/invalid_version.json | 2 +- 0.4/examples/invalid/mismatch_axes_units.json | 2 +- 0.4/examples/invalid/missing_axes.json | 2 +- 0.4/examples/invalid/missing_path.json | 2 +- 0.4/examples/invalid/no_axes.json | 2 +- 0.4/examples/valid/image.json | 2 +- 0.4/examples/valid/image_metadata.json | 2 +- 0.4/examples/valid/image_omero.json | 4 ++-- 0.4/examples/valid/missing_name.json | 2 +- 0.4/examples/valid/missing_version.json | 2 +- 0.4/schemas/image.schema | 4 ++-- 19 files changed, 21 insertions(+), 21 deletions(-) diff --git a/0.4/examples/invalid/empty_transformations.json b/0.4/examples/invalid/empty_transformations.json index 86abc9aa..0445961f 100644 --- a/0.4/examples/invalid/empty_transformations.json +++ b/0.4/examples/invalid/empty_transformations.json @@ -16,7 +16,7 @@ "datasets": [ { "path": "0", - "transformations": [] + "coordinateTransformations": [] } ], "version": "0.4" diff --git a/0.4/examples/invalid/invalid_axes_count.json b/0.4/examples/invalid/invalid_axes_count.json index 35ad59d0..8f14f68b 100644 --- a/0.4/examples/invalid/invalid_axes_count.json +++ b/0.4/examples/invalid/invalid_axes_count.json @@ -11,7 +11,7 @@ "datasets": [ { "path": "0", - "transformations": [ + "coordinateTransformations": [ { "scale": [ 1, diff --git a/0.4/examples/invalid/invalid_axis_type.json b/0.4/examples/invalid/invalid_axis_type.json index 3b9f0b1b..33509a6b 100644 --- a/0.4/examples/invalid/invalid_axis_type.json +++ b/0.4/examples/invalid/invalid_axis_type.json @@ -16,7 +16,7 @@ "datasets": [ { "path": "0", - "transformations": [ + "coordinateTransformations": [ { "scale": [ 1, diff --git a/0.4/examples/invalid/invalid_axis_units.json b/0.4/examples/invalid/invalid_axis_units.json index 7aef1264..078da224 100644 --- a/0.4/examples/invalid/invalid_axis_units.json +++ b/0.4/examples/invalid/invalid_axis_units.json @@ -16,7 +16,7 @@ "datasets": [ { "path": "0", - "transformations": [ + "coordinateTransformations": [ { "scale": [ 0.13, diff --git a/0.4/examples/invalid/invalid_channels_color.json b/0.4/examples/invalid/invalid_channels_color.json index 2fe0f8e5..89d02d5c 100644 --- a/0.4/examples/invalid/invalid_channels_color.json +++ b/0.4/examples/invalid/invalid_channels_color.json @@ -16,7 +16,7 @@ "datasets": [ { "path": "0", - "transformations": [ + "coordinateTransformations": [ { "scale": [1, 1], "type": "scale" diff --git a/0.4/examples/invalid/invalid_channels_window.json b/0.4/examples/invalid/invalid_channels_window.json index 47e91382..0ce38243 100644 --- a/0.4/examples/invalid/invalid_channels_window.json +++ b/0.4/examples/invalid/invalid_channels_window.json @@ -16,7 +16,7 @@ "datasets": [ { "path": "0", - "transformations": [ + "coordinateTransformations": [ { "scale": [ 1, diff --git a/0.4/examples/invalid/invalid_path.json b/0.4/examples/invalid/invalid_path.json index 64bc142d..ef82f0bb 100644 --- a/0.4/examples/invalid/invalid_path.json +++ b/0.4/examples/invalid/invalid_path.json @@ -16,7 +16,7 @@ "datasets": [ { "path": 0, - "transformations": [ + "coordinateTransformations": [ { "scale": [ 1, diff --git a/0.4/examples/invalid/invalid_transformation_type.json b/0.4/examples/invalid/invalid_transformation_type.json index 11db7c00..fbd8e497 100644 --- a/0.4/examples/invalid/invalid_transformation_type.json +++ b/0.4/examples/invalid/invalid_transformation_type.json @@ -16,7 +16,7 @@ "datasets": [ { "path": "0", - "transformations": [ + "coordinateTransformations": [ { "scale": [ 1, diff --git a/0.4/examples/invalid/invalid_version.json b/0.4/examples/invalid/invalid_version.json index 2cb38e8c..cab8991b 100644 --- a/0.4/examples/invalid/invalid_version.json +++ b/0.4/examples/invalid/invalid_version.json @@ -16,7 +16,7 @@ "datasets": [ { "path": "0", - "transformations": [ + "coordinateTransformations": [ { "scale": [ 1, diff --git a/0.4/examples/invalid/mismatch_axes_units.json b/0.4/examples/invalid/mismatch_axes_units.json index ed2d71de..3c10c4ff 100644 --- a/0.4/examples/invalid/mismatch_axes_units.json +++ b/0.4/examples/invalid/mismatch_axes_units.json @@ -21,7 +21,7 @@ "datasets": [ { "path": "0", - "transformations": [ + "coordinateTransformations": [ { "scale": [ 0.13, diff --git a/0.4/examples/invalid/missing_axes.json b/0.4/examples/invalid/missing_axes.json index 01c0953b..e3c2da19 100644 --- a/0.4/examples/invalid/missing_axes.json +++ b/0.4/examples/invalid/missing_axes.json @@ -4,7 +4,7 @@ "datasets": [ { "path": "0", - "transformations": [ + "coordinateTransformations": [ { "scale": [ 1, diff --git a/0.4/examples/invalid/missing_path.json b/0.4/examples/invalid/missing_path.json index b4a706a6..587390fe 100644 --- a/0.4/examples/invalid/missing_path.json +++ b/0.4/examples/invalid/missing_path.json @@ -15,7 +15,7 @@ ], "datasets": [ { - "transformations": [ + "coordinateTransformations": [ { "scale": [ 1, diff --git a/0.4/examples/invalid/no_axes.json b/0.4/examples/invalid/no_axes.json index 610bc6fb..94570af2 100644 --- a/0.4/examples/invalid/no_axes.json +++ b/0.4/examples/invalid/no_axes.json @@ -5,7 +5,7 @@ "datasets": [ { "path": "0", - "transformations": [ + "coordinateTransformations": [ { "scale": [ 1, diff --git a/0.4/examples/valid/image.json b/0.4/examples/valid/image.json index ba517763..fdd24a71 100644 --- a/0.4/examples/valid/image.json +++ b/0.4/examples/valid/image.json @@ -16,7 +16,7 @@ "datasets": [ { "path": "0", - "transformations": [ + "coordinateTransformations": [ { "scale": [1, 1], "type": "scale" diff --git a/0.4/examples/valid/image_metadata.json b/0.4/examples/valid/image_metadata.json index 6d069ebe..8a438ed8 100644 --- a/0.4/examples/valid/image_metadata.json +++ b/0.4/examples/valid/image_metadata.json @@ -9,7 +9,7 @@ "datasets": [ { "path": "path/to/0", - "transformations": [ + "coordinateTransformations": [ { "type": "scale", "scale": [1, 1] diff --git a/0.4/examples/valid/image_omero.json b/0.4/examples/valid/image_omero.json index 4c89e92e..2b209ba9 100644 --- a/0.4/examples/valid/image_omero.json +++ b/0.4/examples/valid/image_omero.json @@ -29,7 +29,7 @@ "datasets": [ { "path": "0", - "transformations": [ + "coordinateTransformations": [ { "scale": [ 1, @@ -54,7 +54,7 @@ }, { "path": "1", - "transformations": [ + "coordinateTransformations": [ { "scale": [ 1, diff --git a/0.4/examples/valid/missing_name.json b/0.4/examples/valid/missing_name.json index dbb5b515..f333aaa9 100644 --- a/0.4/examples/valid/missing_name.json +++ b/0.4/examples/valid/missing_name.json @@ -6,7 +6,7 @@ "datasets": [ { "path": "path/to/0", - "transformations": [ + "coordinateTransformations": [ { "type": "scale", "scale": [1, 1] diff --git a/0.4/examples/valid/missing_version.json b/0.4/examples/valid/missing_version.json index 7a2cb6d5..0e1e6b7f 100644 --- a/0.4/examples/valid/missing_version.json +++ b/0.4/examples/valid/missing_version.json @@ -6,7 +6,7 @@ "datasets": [ { "path": "path/to/0", - "transformations": [ + "coordinateTransformations": [ { "type": "scale", "scale": [1, 1] diff --git a/0.4/schemas/image.schema b/0.4/schemas/image.schema index 84858c39..4b728f14 100644 --- a/0.4/schemas/image.schema +++ b/0.4/schemas/image.schema @@ -23,7 +23,7 @@ "path": { "type": "string" }, - "transformations": { + "coordinateTransformations": { "type": "array", "minItems": 1, "items": { @@ -70,7 +70,7 @@ } } }, - "required": ["path", "transformations"] + "required": ["path", "coordinateTransformations"] } }, "version": { From eb2d99747e63d5710bd713c184743699a4242dff Mon Sep 17 00:00:00 2001 From: Sebastien Besson Date: Mon, 31 Jan 2022 16:34:48 +0000 Subject: [PATCH 06/18] Add example of dataset with missing scale element --- 0.4/examples/invalid/missing_scale.json | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 0.4/examples/invalid/missing_scale.json diff --git a/0.4/examples/invalid/missing_scale.json b/0.4/examples/invalid/missing_scale.json new file mode 100644 index 00000000..ed863677 --- /dev/null +++ b/0.4/examples/invalid/missing_scale.json @@ -0,0 +1,30 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ], + "datasets": [ + { + "path": "0", + "coordinateTransformations": [ + { + "translation": [1, 1], + "type": "translation" + } + ] + } + ], + "version": "0.4" + } + ] +} \ No newline at end of file From b993d8b0ac59d3dfa129d51e9cadf53941eee0c6 Mon Sep 17 00:00:00 2001 From: Sebastien Besson Date: Mon, 31 Jan 2022 16:35:07 +0000 Subject: [PATCH 07/18] Add containment requirement for scale element in coordinateTransformations --- 0.4/schemas/image.schema | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/0.4/schemas/image.schema b/0.4/schemas/image.schema index 4b728f14..4558d7f0 100644 --- a/0.4/schemas/image.schema +++ b/0.4/schemas/image.schema @@ -26,6 +26,24 @@ "coordinateTransformations": { "type": "array", "minItems": 1, + "contains": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "scale" + ] + }, + "scale": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + } + }, "items": { "oneOf": [ { From 456afea04db5a5a738899c2a68173ed6d76e8696 Mon Sep 17 00:00:00 2001 From: Sebastien Besson Date: Mon, 31 Jan 2022 21:33:32 +0000 Subject: [PATCH 08/18] Add additional examples of valid/invalid axes --- 0.4/examples/invalid/duplicate_axes_name.json | 33 ++++++++++++ 0.4/examples/invalid/missing_axes_name.json | 31 +++++++++++ 0.4/examples/invalid/missing_space_axes.json | 31 +++++++++++ 0.4/examples/invalid/one_space_axes.json | 36 +++++++++++++ 0.4/examples/invalid/too_many_axes.json | 51 +++++++++++++++++++ 0.4/examples/invalid/too_many_space_axes.json | 41 +++++++++++++++ 0.4/examples/valid/custom_type_axes.json | 34 +++++++++++++ 0.4/examples/valid/untyped_axes.json | 33 ++++++++++++ 8 files changed, 290 insertions(+) create mode 100644 0.4/examples/invalid/duplicate_axes_name.json create mode 100644 0.4/examples/invalid/missing_axes_name.json create mode 100644 0.4/examples/invalid/missing_space_axes.json create mode 100644 0.4/examples/invalid/one_space_axes.json create mode 100644 0.4/examples/invalid/too_many_axes.json create mode 100644 0.4/examples/invalid/too_many_space_axes.json create mode 100644 0.4/examples/valid/custom_type_axes.json create mode 100644 0.4/examples/valid/untyped_axes.json diff --git a/0.4/examples/invalid/duplicate_axes_name.json b/0.4/examples/invalid/duplicate_axes_name.json new file mode 100644 index 00000000..80ebb176 --- /dev/null +++ b/0.4/examples/invalid/duplicate_axes_name.json @@ -0,0 +1,33 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "x", + "type": "space", + "units": "micron" + }, + { + "name": "x", + "type": "space", + "units": "meter" + } + ], + "datasets": [ + { + "path": "0", + "coordinateTransformations": [ + { + "scale": [ + 0.13, + 0.13 + ], + "type": "scale" + } + ] + } + ], + "version": "0.4" + } + ] +} diff --git a/0.4/examples/invalid/missing_axes_name.json b/0.4/examples/invalid/missing_axes_name.json new file mode 100644 index 00000000..99ce120f --- /dev/null +++ b/0.4/examples/invalid/missing_axes_name.json @@ -0,0 +1,31 @@ +{ + "multiscales": [ + { + "axes": [ + { + "type": "space", + "units": "micron" + }, + { + "type": "space", + "units": "micron" + } + ], + "datasets": [ + { + "path": "0", + "coordinateTransformations": [ + { + "scale": [ + 0.13, + 0.13 + ], + "type": "scale" + } + ] + } + ], + "version": "0.4" + } + ] +} diff --git a/0.4/examples/invalid/missing_space_axes.json b/0.4/examples/invalid/missing_space_axes.json new file mode 100644 index 00000000..75a84711 --- /dev/null +++ b/0.4/examples/invalid/missing_space_axes.json @@ -0,0 +1,31 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "t", + "type": "time" + }, + { + "name": "c", + "type": "channel" + } + ], + "datasets": [ + { + "path": "0", + "coordinateTransformations": [ + { + "scale": [ + 1, + 1 + ], + "type": "scale" + } + ] + } + ], + "version": "0.4" + } + ] +} diff --git a/0.4/examples/invalid/one_space_axes.json b/0.4/examples/invalid/one_space_axes.json new file mode 100644 index 00000000..9fd96a1f --- /dev/null +++ b/0.4/examples/invalid/one_space_axes.json @@ -0,0 +1,36 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "t", + "type": "time" + }, + { + "name": "c", + "type": "channel" + }, + { + "name": "x", + "type": "space" + } + ], + "datasets": [ + { + "path": "0", + "coordinateTransformations": [ + { + "scale": [ + 1, + 1, + 1 + ], + "type": "scale" + } + ] + } + ], + "version": "0.4" + } + ] +} diff --git a/0.4/examples/invalid/too_many_axes.json b/0.4/examples/invalid/too_many_axes.json new file mode 100644 index 00000000..3eba4cfc --- /dev/null +++ b/0.4/examples/invalid/too_many_axes.json @@ -0,0 +1,51 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "angle", + "type": "custom" + }, + { + "name": "t", + "type": "time" + }, + { + "name": "c", + "type": "channel" + }, + { + "name": "z", + "type": "space" + }, + { + "name": "y", + "type": "space" + }, + { + "name": "x", + "type": "space" + } + ], + "datasets": [ + { + "path": "0", + "coordinateTransformations": [ + { + "scale": [ + 1, + 1, + 1, + 1, + 1, + 1 + ], + "type": "scale" + } + ] + } + ], + "version": "0.4" + } + ] +} diff --git a/0.4/examples/invalid/too_many_space_axes.json b/0.4/examples/invalid/too_many_space_axes.json new file mode 100644 index 00000000..5d185260 --- /dev/null +++ b/0.4/examples/invalid/too_many_space_axes.json @@ -0,0 +1,41 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "X", + "type": "space" + }, + { + "name": "z", + "type": "space" + }, + { + "name": "y", + "type": "space" + }, + { + "name": "x", + "type": "space" + } + ], + "datasets": [ + { + "path": "0", + "coordinateTransformations": [ + { + "scale": [ + 1, + 1, + 1, + 1 + ], + "type": "scale" + } + ] + } + ], + "version": "0.4" + } + ] +} diff --git a/0.4/examples/valid/custom_type_axes.json b/0.4/examples/valid/custom_type_axes.json new file mode 100644 index 00000000..557be833 --- /dev/null +++ b/0.4/examples/valid/custom_type_axes.json @@ -0,0 +1,34 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "angle", + "type": "custom" + }, + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ], + "datasets": [ + { + "path": "0", + "coordinateTransformations": [ + { + "scale": [1, 1, 1], + "type": "scale" + } + ] + } + ], + "version": "0.4" + } + ] +} \ No newline at end of file diff --git a/0.4/examples/valid/untyped_axes.json b/0.4/examples/valid/untyped_axes.json new file mode 100644 index 00000000..af65e409 --- /dev/null +++ b/0.4/examples/valid/untyped_axes.json @@ -0,0 +1,33 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "angle" + }, + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ], + "datasets": [ + { + "path": "0", + "coordinateTransformations": [ + { + "scale": [1, 1, 1], + "type": "scale" + } + ] + } + ], + "version": "0.4" + } + ] +} \ No newline at end of file From 6199e5c77deaa19e5c49a70ce1fd19fd21ffb9da Mon Sep 17 00:00:00 2001 From: Sebastien Besson Date: Mon, 31 Jan 2022 21:33:46 +0000 Subject: [PATCH 09/18] Add requirement for 2/3 space axes via contains --- 0.4/schemas/image.schema | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/0.4/schemas/image.schema b/0.4/schemas/image.schema index 4558d7f0..0b39fde1 100644 --- a/0.4/schemas/image.schema +++ b/0.4/schemas/image.schema @@ -100,6 +100,23 @@ "axes": { "type": "array", "minItems": 2, + "contains": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "enum": ["space"] + }, + "units": { + "type": "string" + } + } + }, + "minContains": 2, + "maxContains": 3, "items": { "oneOf": [ { From cecafa80920bdd7e8af67224658df476e69c6e08 Mon Sep 17 00:00:00 2001 From: Sebastien Besson Date: Mon, 31 Jan 2022 21:33:55 +0000 Subject: [PATCH 10/18] Handle custom axes --- 0.4/schemas/image.schema | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/0.4/schemas/image.schema b/0.4/schemas/image.schema index 0b39fde1..4dffbcb1 100644 --- a/0.4/schemas/image.schema +++ b/0.4/schemas/image.schema @@ -169,6 +169,21 @@ } }, "required": ["name", "type"] + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "not": { + "enum": ["space", "time", "channel"] + } + } + }, + "required": ["name"] } ] } From ac87d92af13dcdd47965914149883be52157bee5 Mon Sep 17 00:00:00 2001 From: Sebastien Besson Date: Mon, 31 Jan 2022 21:35:15 +0000 Subject: [PATCH 11/18] Set axes maxItems to 5 --- 0.4/schemas/image.schema | 1 + 1 file changed, 1 insertion(+) diff --git a/0.4/schemas/image.schema b/0.4/schemas/image.schema index 4dffbcb1..5b76ecf5 100644 --- a/0.4/schemas/image.schema +++ b/0.4/schemas/image.schema @@ -100,6 +100,7 @@ "axes": { "type": "array", "minItems": 2, + "maxItems": 5, "contains": { "type": "object", "properties": { From 8a165d79f6974d6501206a17c2e5017f8f245290 Mon Sep 17 00:00:00 2001 From: Sebastien Besson Date: Tue, 1 Feb 2022 09:22:49 +0000 Subject: [PATCH 12/18] Add maxContains to coordinateTransformations to enforce only one scale --- 0.4/examples/invalid/duplicate_scale.json | 40 +++++++++++++++++++++++ 0.4/schemas/image.schema | 1 + 2 files changed, 41 insertions(+) create mode 100644 0.4/examples/invalid/duplicate_scale.json diff --git a/0.4/examples/invalid/duplicate_scale.json b/0.4/examples/invalid/duplicate_scale.json new file mode 100644 index 00000000..f5413ce1 --- /dev/null +++ b/0.4/examples/invalid/duplicate_scale.json @@ -0,0 +1,40 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ], + "datasets": [ + { + "path": "0", + "coordinateTransformations": [ + { + "scale": [ + 1, + 1 + ], + "type": "scale" + }, + { + "scale": [ + 1, + 1 + ], + "type": "scale" + } + ] + } + ], + "version": "0.4" + } + ] +} diff --git a/0.4/schemas/image.schema b/0.4/schemas/image.schema index 5b76ecf5..0862a1c8 100644 --- a/0.4/schemas/image.schema +++ b/0.4/schemas/image.schema @@ -44,6 +44,7 @@ } } }, + "maxContains": 1, "items": { "oneOf": [ { From bd1618c2225c7927854cdf08fd5b6af71ddb69f1 Mon Sep 17 00:00:00 2001 From: William Moore Date: Wed, 2 Feb 2022 11:44:30 +0000 Subject: [PATCH 13/18] Move coordinateTransformations to --- 0.4/schemas/image.schema | 135 ++++++++++++++++++++------------------- 1 file changed, 71 insertions(+), 64 deletions(-) diff --git a/0.4/schemas/image.schema b/0.4/schemas/image.schema index 0862a1c8..60fdf16b 100644 --- a/0.4/schemas/image.schema +++ b/0.4/schemas/image.schema @@ -24,69 +24,7 @@ "type": "string" }, "coordinateTransformations": { - "type": "array", - "minItems": 1, - "contains": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "scale" - ] - }, - "scale": { - "type": "array", - "minItems": 2, - "items": { - "type": "number" - } - } - } - }, - "maxContains": 1, - "items": { - "oneOf": [ - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "scale" - ] - }, - "scale": { - "type": "array", - "minItems": 2, - "items": { - "type": "number" - } - } - }, - "required": ["type", "scale"] - }, - { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "translation" - ] - }, - "translation": { - "type": "array", - "minItems": 2, - "items": { - "type": "number" - } - } - }, - "required": ["type", "translation"] - } - ] - } + "$ref": "#/$defs/coordinateTransformations" } }, "required": ["path", "coordinateTransformations"] @@ -254,5 +192,74 @@ ] } }, - "required": [ "multiscales" ] + "required": [ "multiscales" ], + + + "$defs": { + "coordinateTransformations": { + "type": "array", + "minItems": 1, + "contains": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "scale" + ] + }, + "scale": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + } + }, + "maxContains": 1, + "items": { + "oneOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "scale" + ] + }, + "scale": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + }, + "required": ["type", "scale"] + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "translation" + ] + }, + "translation": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + }, + "required": ["type", "translation"] + } + ] + } + } + } } From 3067dd9d976b2c779d2d5ed1ee5c7fdf6845b470 Mon Sep 17 00:00:00 2001 From: William Moore Date: Wed, 2 Feb 2022 11:47:27 +0000 Subject: [PATCH 14/18] Move axes into --- 0.4/schemas/image.schema | 184 ++++++++++++++++++++------------------- 1 file changed, 93 insertions(+), 91 deletions(-) diff --git a/0.4/schemas/image.schema b/0.4/schemas/image.schema index 60fdf16b..012511f1 100644 --- a/0.4/schemas/image.schema +++ b/0.4/schemas/image.schema @@ -37,96 +37,7 @@ ] }, "axes": { - "type": "array", - "minItems": 2, - "maxItems": 5, - "contains": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "type": { - "type": "string", - "enum": ["space"] - }, - "units": { - "type": "string" - } - } - }, - "minContains": 2, - "maxContains": 3, - "items": { - "oneOf": [ - { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "type": { - "type": "string", - "enum": ["space"] - }, - "units": { - "type": "string", - "enum": [ - "angstrom", "attometer", "centimeter", "decimeter", "exameter", "femtometer", "foot", "gigameter", "hectometer", "inch", "kilometer", "megameter", "meter", "micrometer", "mile", "millimeter", "nanometer", "parsec", "petameter", "picometer", "terameter", "yard", "yoctometer", "yottameter", "zeptometer", "zettameter" - ] - } - }, - "required": ["name", "type"] - }, - { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "type": { - "type": "string", - "enum": ["time"] - }, - "units": { - "type": "string", - "enum": [ - "attosecond", "centisecond", "day", "decisecond", "exasecond", "femtosecond", "gigasecond", "hectosecond", "hour", "kilosecond", "megasecond", "microsecond", "millisecond", "minute", "nanosecond", "petasecond", "picosecond", "second", "terasecond", "yoctosecond", "yottasecond", "zeptosecond", "zettasecond" - ] - } - }, - "required": ["name", "type"] - }, - { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "type": { - "type": "string", - "enum": ["channel"] - } - }, - "required": ["name", "type"] - }, - { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "type": { - "type": "string", - "not": { - "enum": ["space", "time", "channel"] - } - } - }, - "required": ["name"] - } - ] - } + "$ref": "#/$defs/axes" } }, "required": [ @@ -194,8 +105,99 @@ }, "required": [ "multiscales" ], - "$defs": { + "axes": { + "type": "array", + "minItems": 2, + "maxItems": 5, + "contains": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "enum": ["space"] + }, + "units": { + "type": "string" + } + } + }, + "minContains": 2, + "maxContains": 3, + "items": { + "oneOf": [ + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "enum": ["space"] + }, + "units": { + "type": "string", + "enum": [ + "angstrom", "attometer", "centimeter", "decimeter", "exameter", "femtometer", "foot", "gigameter", "hectometer", "inch", "kilometer", "megameter", "meter", "micrometer", "mile", "millimeter", "nanometer", "parsec", "petameter", "picometer", "terameter", "yard", "yoctometer", "yottameter", "zeptometer", "zettameter" + ] + } + }, + "required": ["name", "type"] + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "enum": ["time"] + }, + "units": { + "type": "string", + "enum": [ + "attosecond", "centisecond", "day", "decisecond", "exasecond", "femtosecond", "gigasecond", "hectosecond", "hour", "kilosecond", "megasecond", "microsecond", "millisecond", "minute", "nanosecond", "petasecond", "picosecond", "second", "terasecond", "yoctosecond", "yottasecond", "zeptosecond", "zettasecond" + ] + } + }, + "required": ["name", "type"] + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "enum": ["channel"] + } + }, + "required": ["name", "type"] + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "not": { + "enum": ["space", "time", "channel"] + } + } + }, + "required": ["name"] + } + ] + } + }, "coordinateTransformations": { "type": "array", "minItems": 1, From 40a15df2d8d480bd18db8391fc93728eb70dbd4d Mon Sep 17 00:00:00 2001 From: William Moore Date: Wed, 2 Feb 2022 12:05:56 +0000 Subject: [PATCH 15/18] duplicate_axes_name.json not invalid with schema --- .../{invalid => invalid_but_dont_fail}/duplicate_axes_name.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename 0.4/examples/{invalid => invalid_but_dont_fail}/duplicate_axes_name.json (95%) diff --git a/0.4/examples/invalid/duplicate_axes_name.json b/0.4/examples/invalid_but_dont_fail/duplicate_axes_name.json similarity index 95% rename from 0.4/examples/invalid/duplicate_axes_name.json rename to 0.4/examples/invalid_but_dont_fail/duplicate_axes_name.json index 80ebb176..f9ff7c9e 100644 --- a/0.4/examples/invalid/duplicate_axes_name.json +++ b/0.4/examples/invalid_but_dont_fail/duplicate_axes_name.json @@ -5,7 +5,7 @@ { "name": "x", "type": "space", - "units": "micron" + "units": "meter" }, { "name": "x", From 95c20ed3260239ac33b2bb4e8cb9130ea2d45ed7 Mon Sep 17 00:00:00 2001 From: William Moore Date: Wed, 2 Feb 2022 12:14:02 +0000 Subject: [PATCH 16/18] Remove strict requirement for valid axis units --- .../invalid_axis_units.json | 0 .../mismatch_axes_units.json | 0 0.4/schemas/image.schema | 40 +------------------ 0.4/tests/test_validation.py | 3 +- 4 files changed, 3 insertions(+), 40 deletions(-) rename 0.4/examples/{invalid => valid_if_not_strict}/invalid_axis_units.json (100%) rename 0.4/examples/{invalid => valid_if_not_strict}/mismatch_axes_units.json (100%) diff --git a/0.4/examples/invalid/invalid_axis_units.json b/0.4/examples/valid_if_not_strict/invalid_axis_units.json similarity index 100% rename from 0.4/examples/invalid/invalid_axis_units.json rename to 0.4/examples/valid_if_not_strict/invalid_axis_units.json diff --git a/0.4/examples/invalid/mismatch_axes_units.json b/0.4/examples/valid_if_not_strict/mismatch_axes_units.json similarity index 100% rename from 0.4/examples/invalid/mismatch_axes_units.json rename to 0.4/examples/valid_if_not_strict/mismatch_axes_units.json diff --git a/0.4/schemas/image.schema b/0.4/schemas/image.schema index 012511f1..68dc2c9c 100644 --- a/0.4/schemas/image.schema +++ b/0.4/schemas/image.schema @@ -137,45 +137,7 @@ }, "type": { "type": "string", - "enum": ["space"] - }, - "units": { - "type": "string", - "enum": [ - "angstrom", "attometer", "centimeter", "decimeter", "exameter", "femtometer", "foot", "gigameter", "hectometer", "inch", "kilometer", "megameter", "meter", "micrometer", "mile", "millimeter", "nanometer", "parsec", "petameter", "picometer", "terameter", "yard", "yoctometer", "yottameter", "zeptometer", "zettameter" - ] - } - }, - "required": ["name", "type"] - }, - { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "type": { - "type": "string", - "enum": ["time"] - }, - "units": { - "type": "string", - "enum": [ - "attosecond", "centisecond", "day", "decisecond", "exasecond", "femtosecond", "gigasecond", "hectosecond", "hour", "kilosecond", "megasecond", "microsecond", "millisecond", "minute", "nanosecond", "petasecond", "picosecond", "second", "terasecond", "yoctosecond", "yottasecond", "zeptosecond", "zettasecond" - ] - } - }, - "required": ["name", "type"] - }, - { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "type": { - "type": "string", - "enum": ["channel"] + "enum": ["channel", "time", "space"] } }, "required": ["name", "type"] diff --git a/0.4/tests/test_validation.py b/0.4/tests/test_validation.py index 48a3c4ed..f00608f2 100644 --- a/0.4/tests/test_validation.py +++ b/0.4/tests/test_validation.py @@ -9,6 +9,7 @@ def files(): return list(glob.glob(f"examples/valid/*.json")) + \ + list(glob.glob(f"examples/valid_if_not_strict/*.json")) + \ list(glob.glob(f"examples/invalid/*.json")) def ids(): @@ -18,7 +19,7 @@ def ids(): @pytest.mark.parametrize("testfile", files(), ids=ids()) def test_json(testfile): - if "invalid" in testfile: + if "examples/invalid/" in testfile: with pytest.raises(ValidationError): json_schema(testfile) else: From 36340bef0bdbda8de150505cdcad9f0f9969e5da Mon Sep 17 00:00:00 2001 From: William Moore Date: Wed, 2 Feb 2022 12:22:14 +0000 Subject: [PATCH 17/18] Add uniqueItems to axes --- 0.4/examples/invalid/duplicate_axes.json | 33 +++++++++++++++++++ .../duplicate_axes_name.json | 2 +- 0.4/schemas/image.schema | 1 + 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 0.4/examples/invalid/duplicate_axes.json diff --git a/0.4/examples/invalid/duplicate_axes.json b/0.4/examples/invalid/duplicate_axes.json new file mode 100644 index 00000000..ede5e00e --- /dev/null +++ b/0.4/examples/invalid/duplicate_axes.json @@ -0,0 +1,33 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "x", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ], + "datasets": [ + { + "path": "0", + "coordinateTransformations": [ + { + "scale": [ + 1, + 1 + ], + "type": "scale" + } + ] + } + ], + "version": "0.4" + } + ] +} \ No newline at end of file diff --git a/0.4/examples/invalid_but_dont_fail/duplicate_axes_name.json b/0.4/examples/invalid_but_dont_fail/duplicate_axes_name.json index f9ff7c9e..a811f9a3 100644 --- a/0.4/examples/invalid_but_dont_fail/duplicate_axes_name.json +++ b/0.4/examples/invalid_but_dont_fail/duplicate_axes_name.json @@ -10,7 +10,7 @@ { "name": "x", "type": "space", - "units": "meter" + "units": "micrometer" } ], "datasets": [ diff --git a/0.4/schemas/image.schema b/0.4/schemas/image.schema index 68dc2c9c..55064442 100644 --- a/0.4/schemas/image.schema +++ b/0.4/schemas/image.schema @@ -108,6 +108,7 @@ "$defs": { "axes": { "type": "array", + "uniqueItems": true, "minItems": 2, "maxItems": 5, "contains": { From 2459b15c59161678a6077043a58189de37628694 Mon Sep 17 00:00:00 2001 From: William Moore Date: Wed, 2 Feb 2022 12:31:04 +0000 Subject: [PATCH 18/18] validate multiscales:coordinateTransformations --- .../invalid_multiscales_transformations.json | 39 +++++++++++++++++ .../valid/multiscales_transformations.json | 42 +++++++++++++++++++ 0.4/schemas/image.schema | 5 ++- 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 0.4/examples/invalid/invalid_multiscales_transformations.json create mode 100644 0.4/examples/valid/multiscales_transformations.json diff --git a/0.4/examples/invalid/invalid_multiscales_transformations.json b/0.4/examples/invalid/invalid_multiscales_transformations.json new file mode 100644 index 00000000..b93f37e6 --- /dev/null +++ b/0.4/examples/invalid/invalid_multiscales_transformations.json @@ -0,0 +1,39 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ], + "datasets": [ + { + "path": "0", + "coordinateTransformations": [ + { + "scale": [ + 1, + 1 + ], + "type": "scale" + } + ] + } + ], + "coordinateTransformations": [ + { + "scale": ["invalid"], + "type": "scale" + } + ], + "version": "0.4" + } + ] +} \ No newline at end of file diff --git a/0.4/examples/valid/multiscales_transformations.json b/0.4/examples/valid/multiscales_transformations.json new file mode 100644 index 00000000..f9c2af46 --- /dev/null +++ b/0.4/examples/valid/multiscales_transformations.json @@ -0,0 +1,42 @@ +{ + "multiscales": [ + { + "axes": [ + { + "name": "y", + "type": "space", + "units": "micrometer" + }, + { + "name": "x", + "type": "space", + "units": "micrometer" + } + ], + "datasets": [ + { + "path": "0", + "coordinateTransformations": [ + { + "scale": [ + 1, + 1 + ], + "type": "scale" + } + ] + } + ], + "coordinateTransformations": [ + { + "scale": [ + 10, + 10 + ], + "type": "scale" + } + ], + "version": "0.4" + } + ] +} \ No newline at end of file diff --git a/0.4/schemas/image.schema b/0.4/schemas/image.schema index 55064442..6250de66 100644 --- a/0.4/schemas/image.schema +++ b/0.4/schemas/image.schema @@ -38,7 +38,10 @@ }, "axes": { "$ref": "#/$defs/axes" - } + }, + "coordinateTransformations": { + "$ref": "#/$defs/coordinateTransformations" + } }, "required": [ "datasets", "axes"