diff --git a/.gitignore b/.gitignore index e7e34dc8..54c43d54 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ schemas/**/*.md schemas/**/*.html schemas/**/*.css schemas/**/*.js +examples/_build # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/conformance/ome_zarr_conformance.py b/conformance/ome_zarr_conformance.py index 5614e44c..c4b40c09 100644 --- a/conformance/ome_zarr_conformance.py +++ b/conformance/ome_zarr_conformance.py @@ -8,23 +8,73 @@ """ from __future__ import annotations -from concurrent.futures import Future, ThreadPoolExecutor + +import json +import logging import os +import re import subprocess as sp -from argparse import ArgumentParser -from pathlib import Path import sys -import re -import json +from argparse import ArgumentParser +from collections.abc import Iterable +from concurrent.futures import Future, ThreadPoolExecutor from dataclasses import dataclass -from typing import Any, Iterable, Literal, Self -import logging +from pathlib import Path +from typing import Any, Literal, Self logger = logging.getLogger("ome_zarr_conformance") here = Path(__file__).resolve().parent.parent tests_dir = here / "tests" +Status = Literal["pass", "fail", "error"] + + +def color(s: str, num: int, is_bright=False, is_background=False) -> str: + match (is_bright, is_background): + case (False, False): + pref = "3" + case (False, True): + pref = "4" + case (True, False): + pref = "9" + case (True, True): + pref = "10" + return f"\x1b[{pref}{num}m{s}\x1b[0m" + + +class Colorer: + def __init__(self) -> None: + self.is_term = sys.stdout.isatty() + + def _colour(self, s: str, num: int, is_bright=False, is_background=False) -> str: + if not self.is_term: + return s + return color(s, num, is_bright, is_background) + + def r(self, s: str) -> str: + return self._colour(s, 1) + + def g(self, s: str) -> str: + return self._colour(s, 2) + + def y(self, s: str) -> str: + return self._colour(s, 3) + + def m(self, s: str) -> str: + return self._colour(s, 5) + + def status(self, s: Status) -> str: + match s: + case "pass": + return self.g(s) + case "fail": + return self.r(s) + case "error": + return self.m(s) + case other: + raise ValueError(f"Unknown status '{other}'") + @dataclass class CommandOutput: @@ -39,7 +89,7 @@ def from_jso(cls, jso: dict[str, Any]) -> Self: @dataclass class TestResult: test_name: str - status: Literal["pass", "fail", "error"] + status: Status message: str | None stderr: str return_code: int @@ -48,14 +98,12 @@ class TestResult: @dataclass class Conformance: - strict: bool valid: bool description: bool | None @classmethod def from_jso(cls, jso: dict[str, Any]) -> Self: return cls( - strict=jso.get("strict", False), valid=jso.get("valid", True), description=jso.get("description"), ) @@ -80,25 +128,21 @@ def __init__( self, exclude_patterns: list[re.Pattern] | None = None, include_patterns: list[re.Pattern] | None = None, - exclude_strict=False, exclude_invalid=False, ) -> None: self.exclude_patterns = exclude_patterns or [] self.include_patterns = include_patterns or [] - if exclude_strict: - self.exclude_patterns.append(re.compile(r"^strict/")) if exclude_invalid: self.exclude_patterns.append(re.compile(r"^\w+/invalid/")) def include(self, name: str) -> bool: if self.exclude_patterns and any(p.search(name) for p in self.exclude_patterns): return False - if self.include_patterns and not any( - p.search(name) for p in self.include_patterns - ): - return False - return True + + if not self.include_patterns: + return True + return any(p.search(name) for p in self.include_patterns) def test_path_to_name(fpath: Path, root: Path) -> str: @@ -110,7 +154,9 @@ def run_test(dingus_cmd: list[str], fpath: Path, test_name: str) -> TestResult: test_logger = logger.getChild(test_name) strictness, validity, *_ = test_name.split("/") - if strictness not in ("strict", "spec"): + # previously there were "strict" tests which treated schema SHOULDs as MUSTs; + # these have since been removed + if strictness != "spec": raise RuntimeError(f"cannot determine strictness from name: {test_name}") if validity == "invalid": @@ -124,6 +170,7 @@ def run_test(dingus_cmd: list[str], fpath: Path, test_name: str) -> TestResult: dingus_cmd + [os.fspath(fpath)], text=True, capture_output=True, + check=False, ) if res.returncode: @@ -205,7 +252,7 @@ def main(raw_args=None): "--exclude-strict", "-S", action="store_true", - help="exclude strict tests", + help="DEPRECATED: exclude strict tests", ) parser.add_argument( "--exclude-invalid", @@ -241,7 +288,12 @@ def main(raw_args=None): 3: logging.DEBUG, }.get(args.verbose, logging.DEBUG) logging.basicConfig(level=lvl) - logging.debug("Got args: %s", args) + logger.debug("Got args: %s", args) + + if args.exclude_strict: + logger.warning( + "Strict test cases are deprecated; -S/--exclude-strict argument is implicit and will soon be removed." + ) if dingus_args is None: print( @@ -267,21 +319,18 @@ def main(raw_args=None): req = Requested( exclude_patterns=args.exclude_pattern, include_patterns=args.include_pattern, - exclude_strict=bool(args.exclude_strict), exclude_invalid=bool(args.exclude_invalid), ) test_paths = ((test_path_to_name(p, dpath), p) for p in dpath.rglob(rglob)) cases = dict(sorted((n, p) for n, p in test_paths if req.include(n))) + c = Colorer() + for res in run_all_tests( dingus_args, cases, ): - row = [ - res.test_name, - res.status, - ] if res.status == "pass": passes += 1 elif res.status == "fail": @@ -289,6 +338,13 @@ def main(raw_args=None): elif res.status == "error": errors += 1 + row = [ + res.test_name, + c.status(res.status), + ] + if res.message: + row.append(" ".join(res.message.split())) + print("\t".join(row)) logger.info("Got %s passes, %s failures, %s errors", passes, failures, errors) diff --git a/examples/bf2raw/.config.json b/examples/_static/bf2raw/.config.json similarity index 100% rename from examples/bf2raw/.config.json rename to examples/_static/bf2raw/.config.json diff --git a/examples/bf2raw/image.json b/examples/_static/bf2raw/image.json similarity index 78% rename from examples/bf2raw/image.json rename to examples/_static/bf2raw/image.json index 28d1019b..9b6d6d19 100644 --- a/examples/bf2raw/image.json +++ b/examples/_static/bf2raw/image.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "bioformats2raw.layout": 3 } } diff --git a/examples/bf2raw/plate.json b/examples/_static/bf2raw/plate.json similarity index 94% rename from examples/bf2raw/plate.json rename to examples/_static/bf2raw/plate.json index 8c21052c..8044f226 100644 --- a/examples/bf2raw/plate.json +++ b/examples/_static/bf2raw/plate.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "bioformats2raw.layout": 3, "plate": { "columns": [ diff --git a/examples/_static/label/.config.json b/examples/_static/label/.config.json new file mode 100644 index 00000000..095b45e7 --- /dev/null +++ b/examples/_static/label/.config.json @@ -0,0 +1,3 @@ +{ + "schema": "schemas/label.schema" +} diff --git a/examples/label_strict/colors_properties.json b/examples/_static/label/colors_properties.json similarity index 97% rename from examples/label_strict/colors_properties.json rename to examples/_static/label/colors_properties.json index aebd8689..c9d5b835 100644 --- a/examples/label_strict/colors_properties.json +++ b/examples/_static/label/colors_properties.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "multiscales": [ { "coordinateSystems": [ diff --git a/examples/transformations/displacements/.config.json b/examples/_static/multiscales/.config.json similarity index 100% rename from examples/transformations/displacements/.config.json rename to examples/_static/multiscales/.config.json diff --git a/examples/multiscales_strict/multiscales_example.json b/examples/_static/multiscales/multiscales_example.json similarity index 98% rename from examples/multiscales_strict/multiscales_example.json rename to examples/_static/multiscales/multiscales_example.json index ccc340ec..5a922e01 100644 --- a/examples/multiscales_strict/multiscales_example.json +++ b/examples/_static/multiscales/multiscales_example.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "multiscales": [ { "name": "example", diff --git a/examples/multiscales_strict/multiscales_example_relative.json b/examples/_static/multiscales/multiscales_example_relative.json similarity index 98% rename from examples/multiscales_strict/multiscales_example_relative.json rename to examples/_static/multiscales/multiscales_example_relative.json index 2c0c7f26..0ceddc15 100644 --- a/examples/multiscales_strict/multiscales_example_relative.json +++ b/examples/_static/multiscales/multiscales_example_relative.json @@ -1,7 +1,7 @@ { "multiscales": [ { - "version": "0.6rc0", + "version": "{{ VERSION }}", "name": "example", "coordinateSystems" : [ { diff --git a/examples/multiscales_strict/multiscales_reference_to_label.json b/examples/_static/multiscales/multiscales_reference_to_label.json similarity index 96% rename from examples/multiscales_strict/multiscales_reference_to_label.json rename to examples/_static/multiscales/multiscales_reference_to_label.json index 0d756cc9..307207ec 100644 --- a/examples/multiscales_strict/multiscales_reference_to_label.json +++ b/examples/_static/multiscales/multiscales_reference_to_label.json @@ -1,6 +1,6 @@ { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "multiscales": [ { "name": "Image", diff --git a/examples/multiscales_strict/multiscales_transformations.json b/examples/_static/multiscales/multiscales_transformations.json similarity index 98% rename from examples/multiscales_strict/multiscales_transformations.json rename to examples/_static/multiscales/multiscales_transformations.json index cf601322..50172274 100644 --- a/examples/multiscales_strict/multiscales_transformations.json +++ b/examples/_static/multiscales/multiscales_transformations.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "multiscales": [ { "coordinateSystems": [ diff --git a/examples/ome/.config.json b/examples/_static/ome/.config.json similarity index 100% rename from examples/ome/.config.json rename to examples/_static/ome/.config.json diff --git a/examples/ome/series-2.json b/examples/_static/ome/series-2.json similarity index 77% rename from examples/ome/series-2.json rename to examples/_static/ome/series-2.json index 023d23a7..7d1d9c4d 100644 --- a/examples/ome/series-2.json +++ b/examples/_static/ome/series-2.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "series": ["0", "1"] } } diff --git a/examples/_static/plate/.config.json b/examples/_static/plate/.config.json new file mode 100644 index 00000000..939366ad --- /dev/null +++ b/examples/_static/plate/.config.json @@ -0,0 +1,3 @@ +{ + "schema": "schemas/plate.schema" +} \ No newline at end of file diff --git a/examples/plate_strict/plate_2wells.json b/examples/_static/plate/plate_2wells.json similarity index 97% rename from examples/plate_strict/plate_2wells.json rename to examples/_static/plate/plate_2wells.json index 09f4bec1..8d6fcc4a 100644 --- a/examples/plate_strict/plate_2wells.json +++ b/examples/_static/plate/plate_2wells.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "plate": { "acquisitions": [ { diff --git a/examples/plate_strict/plate_6wells.json b/examples/_static/plate/plate_6wells.json similarity index 97% rename from examples/plate_strict/plate_6wells.json rename to examples/_static/plate/plate_6wells.json index 0f6b2d2c..181da381 100644 --- a/examples/plate_strict/plate_6wells.json +++ b/examples/_static/plate/plate_6wells.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "plate": { "acquisitions": [ { diff --git a/examples/scene/.config.json b/examples/_static/scene/.config.json similarity index 100% rename from examples/scene/.config.json rename to examples/_static/scene/.config.json diff --git a/examples/scene/scene_registration.json b/examples/_static/scene/scene_registration.json similarity index 98% rename from examples/scene/scene_registration.json rename to examples/_static/scene/scene_registration.json index e70d3fa0..ff856765 100644 --- a/examples/scene/scene_registration.json +++ b/examples/_static/scene/scene_registration.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "scene": { "coordinateTransformations": [ { diff --git a/examples/scene/scene_stitching.json b/examples/_static/scene/scene_stitching.json similarity index 98% rename from examples/scene/scene_stitching.json rename to examples/_static/scene/scene_stitching.json index e4cf25da..0cce8802 100644 --- a/examples/scene/scene_stitching.json +++ b/examples/_static/scene/scene_stitching.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "scene": { "coordinateTransformations": [ { diff --git a/examples/subspace/.config.json b/examples/_static/subspace/.config.json similarity index 100% rename from examples/subspace/.config.json rename to examples/_static/subspace/.config.json diff --git a/examples/subspace/subspacePermute.json b/examples/_static/subspace/subspacePermute.json similarity index 98% rename from examples/subspace/subspacePermute.json rename to examples/_static/subspace/subspacePermute.json index e2c53ee0..3bdb2380 100644 --- a/examples/subspace/subspacePermute.json +++ b/examples/_static/subspace/subspacePermute.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "multiscales": [ { "name": "multiscales", diff --git a/examples/transformations/.config.json b/examples/_static/transformations/.config.json similarity index 100% rename from examples/transformations/.config.json rename to examples/_static/transformations/.config.json diff --git a/examples/transformations/affine2d2d.json b/examples/_static/transformations/affine2d2d.json similarity index 100% rename from examples/transformations/affine2d2d.json rename to examples/_static/transformations/affine2d2d.json diff --git a/examples/transformations/affine2d2d_with_channel.json b/examples/_static/transformations/affine2d2d_with_channel.json similarity index 100% rename from examples/transformations/affine2d2d_with_channel.json rename to examples/_static/transformations/affine2d2d_with_channel.json diff --git a/examples/transformations/affine2d3d.json b/examples/_static/transformations/affine2d3d.json similarity index 100% rename from examples/transformations/affine2d3d.json rename to examples/_static/transformations/affine2d3d.json diff --git a/examples/transformations/bijection.json b/examples/_static/transformations/bijection.json similarity index 100% rename from examples/transformations/bijection.json rename to examples/_static/transformations/bijection.json diff --git a/examples/transformations/bijection_verbose.json b/examples/_static/transformations/bijection_verbose.json similarity index 100% rename from examples/transformations/bijection_verbose.json rename to examples/_static/transformations/bijection_verbose.json diff --git a/examples/transformations/byDimension1.json b/examples/_static/transformations/byDimension1.json similarity index 100% rename from examples/transformations/byDimension1.json rename to examples/_static/transformations/byDimension1.json diff --git a/examples/transformations/byDimension2.json b/examples/_static/transformations/byDimension2.json similarity index 100% rename from examples/transformations/byDimension2.json rename to examples/_static/transformations/byDimension2.json diff --git a/examples/transformations/byDimensionCoordinates.json b/examples/_static/transformations/byDimensionCoordinates.json similarity index 100% rename from examples/transformations/byDimensionCoordinates.json rename to examples/_static/transformations/byDimensionCoordinates.json diff --git a/examples/transformations/byDimensionInvalid1.json b/examples/_static/transformations/byDimensionInvalid1.json similarity index 100% rename from examples/transformations/byDimensionInvalid1.json rename to examples/_static/transformations/byDimensionInvalid1.json diff --git a/examples/transformations/byDimensionInvalid2.json b/examples/_static/transformations/byDimensionInvalid2.json similarity index 100% rename from examples/transformations/byDimensionInvalid2.json rename to examples/_static/transformations/byDimensionInvalid2.json diff --git a/examples/transformations/byDimensionXarray.json b/examples/_static/transformations/byDimensionXarray.json similarity index 100% rename from examples/transformations/byDimensionXarray.json rename to examples/_static/transformations/byDimensionXarray.json diff --git a/examples/_static/transformations/displacements/.config.json b/examples/_static/transformations/displacements/.config.json new file mode 100644 index 00000000..029ae09c --- /dev/null +++ b/examples/_static/transformations/displacements/.config.json @@ -0,0 +1,3 @@ +{ + "schema": "schemas/image.schema" +} \ No newline at end of file diff --git a/examples/transformations/displacements/displacement_field.json b/examples/_static/transformations/displacements/displacement_field.json similarity index 100% rename from examples/transformations/displacements/displacement_field.json rename to examples/_static/transformations/displacements/displacement_field.json diff --git a/examples/transformations/displacements/multiscales.json b/examples/_static/transformations/displacements/multiscales.json similarity index 100% rename from examples/transformations/displacements/multiscales.json rename to examples/_static/transformations/displacements/multiscales.json diff --git a/examples/transformations/identity.json b/examples/_static/transformations/identity.json similarity index 100% rename from examples/transformations/identity.json rename to examples/_static/transformations/identity.json diff --git a/examples/transformations/mapAxis1.json b/examples/_static/transformations/mapAxis1.json similarity index 100% rename from examples/transformations/mapAxis1.json rename to examples/_static/transformations/mapAxis1.json diff --git a/examples/transformations/projectAxis.json b/examples/_static/transformations/projectAxis.json similarity index 100% rename from examples/transformations/projectAxis.json rename to examples/_static/transformations/projectAxis.json diff --git a/examples/transformations/projectAxis2.json b/examples/_static/transformations/projectAxis2.json similarity index 100% rename from examples/transformations/projectAxis2.json rename to examples/_static/transformations/projectAxis2.json diff --git a/examples/transformations/rotation.json b/examples/_static/transformations/rotation.json similarity index 100% rename from examples/transformations/rotation.json rename to examples/_static/transformations/rotation.json diff --git a/examples/transformations/scale.json b/examples/_static/transformations/scale.json similarity index 100% rename from examples/transformations/scale.json rename to examples/_static/transformations/scale.json diff --git a/examples/transformations/scale_with_discrete.json b/examples/_static/transformations/scale_with_discrete.json similarity index 100% rename from examples/transformations/scale_with_discrete.json rename to examples/_static/transformations/scale_with_discrete.json diff --git a/examples/transformations/sequence.json b/examples/_static/transformations/sequence.json similarity index 100% rename from examples/transformations/sequence.json rename to examples/_static/transformations/sequence.json diff --git a/examples/transformations/translation.json b/examples/_static/transformations/translation.json similarity index 100% rename from examples/transformations/translation.json rename to examples/_static/transformations/translation.json diff --git a/examples/transformations/xarrayLike.json b/examples/_static/transformations/xarrayLike.json similarity index 100% rename from examples/transformations/xarrayLike.json rename to examples/_static/transformations/xarrayLike.json diff --git a/examples/_static/well/.config.json b/examples/_static/well/.config.json new file mode 100644 index 00000000..af9ba888 --- /dev/null +++ b/examples/_static/well/.config.json @@ -0,0 +1,3 @@ +{ + "schema": "schemas/well.schema" +} \ No newline at end of file diff --git a/examples/well_strict/well_2fields.json b/examples/_static/well/well_2fields.json similarity index 89% rename from examples/well_strict/well_2fields.json rename to examples/_static/well/well_2fields.json index 636edf2e..763f5b50 100644 --- a/examples/well_strict/well_2fields.json +++ b/examples/_static/well/well_2fields.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "well": { "images": [ { diff --git a/examples/well_strict/well_4fields.json b/examples/_static/well/well_4fields.json similarity index 93% rename from examples/well_strict/well_4fields.json rename to examples/_static/well/well_4fields.json index 9baae566..7a80782a 100644 --- a/examples/well_strict/well_4fields.json +++ b/examples/_static/well/well_4fields.json @@ -3,7 +3,7 @@ "node_type": "group", "attributes": { "ome": { - "version": "0.6rc0", + "version": "{{ VERSION }}", "well": { "images": [ { diff --git a/examples/label_strict/.config.json b/examples/label_strict/.config.json deleted file mode 100644 index e7329dc9..00000000 --- a/examples/label_strict/.config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "schema": "schemas/strict_label.schema" -} diff --git a/examples/multiscales_strict/.config.json b/examples/multiscales_strict/.config.json deleted file mode 100644 index b0469538..00000000 --- a/examples/multiscales_strict/.config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "schema": "schemas/strict_image.schema" -} diff --git a/examples/plate_strict/.config.json b/examples/plate_strict/.config.json deleted file mode 100644 index a49b1743..00000000 --- a/examples/plate_strict/.config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "schema": "schemas/strict_plate.schema" -} diff --git a/examples/well_strict/.config.json b/examples/well_strict/.config.json deleted file mode 100644 index 129ac69c..00000000 --- a/examples/well_strict/.config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "schema": "schemas/strict_well.schema" -} diff --git a/index.md b/index.md index da28878a..f0649181 100644 --- a/index.md +++ b/index.md @@ -340,7 +340,7 @@ series.ome.zarr # One converted fileset from bioformats2raw The OME-Zarr Metadata in the top-level `zarr.json` file must contain the `bioformats2raw.layout` key: -```{literalinclude} examples/bf2raw/image.json +```{literalinclude} examples/_build/bf2raw/image.json :language: json ``` @@ -348,13 +348,13 @@ If the top-level group represents a plate, the `bioformats2raw.layout` metadata but the `plate` key MUST also be present, takes precedence and parsing of such datasets should follow (see [plate metadata](#plate-md)). It is not possible to mix collections of images with plates at present. -```{literalinclude} examples/bf2raw/plate.json +```{literalinclude} examples/_build/bf2raw/plate.json :language: json ``` The OME-Zarr Metadata in the `zarr.json` file within the OME group may contain the `series` key: -```{literalinclude} examples/ome/series-2.json +```{literalinclude} examples/_build/ome/series-2.json :language: json ``` @@ -423,7 +423,7 @@ The following transformations are supported: | [`bijection`](#bijection-md) | `"forward":Transformation`
`"inverse":Transformation` | An invertible transformation providing an explicit forward transformation and its inverse. | | [`byDimension`](#bydimension-md) | `"transformations":List[Transformation]`.
Transformations in the array MUST have
`"inputAxes": List[number]`,
and `"outputAxes": List[number]` | A high dimensional transformation using lower dimensional transformations on subsets of dimensions. | -The parameter values (e.g., `scale` for a [scale transformation](#scale-md)) MUST be compatible with input and output space dimensionality (see details). +The parameter values (e.g., `scale` for a [scale transformation](#scale-md)) MUST be compatible with input and output space dimensionality (see details). The `input` and `output` fields are objects structured as follows: @@ -465,7 +465,7 @@ Depending on which, different constraints apply to the transformations, as descr - Both `input` and `output` MUST specify a coordinate system `name`. - `path` is required when referencing a coordinate system in a multiscale image subgroup; it MAY be omitted or null when referencing a coordinate system defined in the scene's own `coordinateSystems`. - + In any context, the values given for `name` and `path` provide an unambiguous reference to a named coordinate system. If the `path` field is null or omitted, this is to be interpreted as referring to a named coordinate system in the same `zarr.json` file. @@ -692,7 +692,7 @@ is set to the position of the ith axis of the input coordinate system. :::{dropdown} Example -```{literalinclude} examples/transformations/identity.json +```{literalinclude} examples/_build/transformations/identity.json :language: json ``` @@ -724,7 +724,7 @@ The value at position `i` in the array indicates which input axis becomes the `i :::{dropdown} Example 1 -```{literalinclude} examples/transformations/mapAxis1.json +```{literalinclude} examples/_build/transformations/mapAxis1.json :language: json ``` @@ -765,7 +765,7 @@ In this example, the output coordinate system `out` contains two more axes (`c` than the input coordinate system `in`. This is reflected by the following `projectAxis` transformation: -```{literalinclude} examples/transformations/projectAxis.json +```{literalinclude} examples/_build/transformations/projectAxis.json :language: json ``` @@ -783,7 +783,7 @@ In this example, the output coordinate system `out` contains one axes more (`z`) than the input coordinate system `in`. This is reflected by the following `projectAxis` transformation: -```{literalinclude} examples/transformations/projectAxis2.json +```{literalinclude} examples/_build/transformations/projectAxis2.json :language: json ``` which defines the function @@ -818,7 +818,7 @@ The array MUST have length `N`. :::{dropdown} Example -```{literalinclude} examples/transformations/translation.json +```{literalinclude} examples/_build/transformations/translation.json :language: json ``` @@ -846,7 +846,7 @@ The array MUST have length `N`. :::{dropdown} Example 1 (spec:example:coordinate_transformation_scale)= -```{literalinclude} examples/transformations/scale.json +```{literalinclude} examples/_build/transformations/scale.json :language: json ``` @@ -865,7 +865,7 @@ i.e., the mapping from the first input axis to the first output axis is determin If the data contains discrete axes (e.g., channels), these axes are typically not transformed, but must be represented in the scale parameters. -```{literalinclude} examples/transformations/scale_with_discrete.json +```{literalinclude} examples/_build/transformations/scale_with_discrete.json :language: json ``` ::: @@ -892,7 +892,7 @@ where the outer array MUST be length `M` and the inner arrays MUST be length `N+ :::{dropdown} Example 1 A 2D-2D example: -```{literalinclude} examples/transformations/affine2d2d.json +```{literalinclude} examples/_build/transformations/affine2d2d.json :language: json ``` @@ -923,7 +923,7 @@ Note that the order of the axes can in general be determined by the application These axes relate to the memory or on-disk order insofar as the last dimension is contiguous when the zarr array is c-order (the default for zarr version 2, and the only option for zarr version 3). -```{literalinclude} examples/transformations/affine2d3d.json +```{literalinclude} examples/_build/transformations/affine2d3d.json :language: json ``` @@ -953,7 +953,7 @@ where the last row `[0 0 1]` is omitted in the JSON representation. If the image data contains discrete axes (e.g., channels), these axes are typically not transformed, but must be represented in the transformation matrix. -```{literalinclude} examples/transformations/affine2d2d_with_channel.json +```{literalinclude} examples/_build/transformations/affine2d2d_with_channel.json :language: json ``` ::: @@ -981,7 +981,7 @@ and the inner arrays MUST be length `N`. :::{dropdown} Example A 2D example -```{literalinclude} examples/transformations/rotation.json +```{literalinclude} examples/_build/transformations/rotation.json :language: json ``` @@ -1026,7 +1026,7 @@ f2(f1(f0(x))) This sequence: -```{literalinclude} examples/transformations/sequence.json +```{literalinclude} examples/_build/transformations/sequence.json :language: json ``` @@ -1101,7 +1101,7 @@ An exact reproducibility of pixel values for images transformed and resampled by The multiscale group at `path` MUST satisfy: - **Dimensionality**: If the input coordinate system has `N` axes, the multiscale image at location `path` MUST have `N+1` dimensions. - - **Vector dimension length**: + - **Vector dimension length**: - For `coordinates` transformations, the length of the array along the `coordinate` dimension (last axis) MUST equal `M`, the number of axes in the output coordinate system. - For `displacements` transformations, the length of the array along the `displacement` dimension (last axis) MUST equal `N`, @@ -1129,7 +1129,7 @@ Applying the transformation to a point `x` in physical coordinates in the input In this example, a `displacements` transformation is defined between two 2D coordinate systems, `physical` and `output`. The transformation references a displacement vector field located at `coordinateTransformations/displacementField`. -```{literalinclude} examples/transformations/displacements/multiscales.json +```{literalinclude} examples/_build/transformations/displacements/multiscales.json :language: json ``` @@ -1137,7 +1137,7 @@ This multiscales (containing the vector field) MUST have three dimensions, i.e., `x` and `y` as mandated by the input coordinate system and an additional dimension `c` to hold the x- and y-displacements. The metadata for the multiscale group at location `coordinateTransformations/displacementField` would look as follows: -```{literalinclude} examples/transformations/displacements/displacement_field.json +```{literalinclude} examples/_build/transformations/displacements/displacement_field.json :language: json ``` @@ -1189,7 +1189,7 @@ using lower dimensional transformations on subsets of dimensions. A valid `byDimension` transformation: -```{literalinclude} examples/transformations/byDimension1.json +```{literalinclude} examples/_build/transformations/byDimension1.json :language: json ``` ::: @@ -1198,7 +1198,7 @@ A valid `byDimension` transformation: Another valid `byDimension` transformation: -```{literalinclude} examples/transformations/byDimension2.json +```{literalinclude} examples/_build/transformations/byDimension2.json :language: json ``` ::: @@ -1207,7 +1207,7 @@ Another valid `byDimension` transformation: This is an **invalid** `byDimension` transform: -```{literalinclude} examples/transformations/byDimensionInvalid1.json +```{literalinclude} examples/_build/transformations/byDimensionInvalid1.json :language: json ``` @@ -1220,7 +1220,7 @@ The coordinate system has two axes (indices `0` and `1`), but the transformation Another **invalid** `byDimension` transform: -```{literalinclude} examples/transformations/byDimensionInvalid2.json +```{literalinclude} examples/_build/transformations/byDimensionInvalid2.json :language: json ``` @@ -1254,13 +1254,13 @@ It may not be correct for any point of appropriate dimensionality. :::{dropdown} Example -```{literalinclude} examples/transformations/bijection.json +```{literalinclude} examples/_build/transformations/bijection.json :language: json ``` the input and output of the `forward` and `inverse` transformations are understood to be: -```{literalinclude} examples/transformations/bijection_verbose.json +```{literalinclude} examples/_build/transformations/bijection_verbose.json :language: json ``` ::: @@ -1401,7 +1401,7 @@ In this example, a multiscales group containing labels is located at `labels/lab :::{dropdown} Example: Complete multiscales metadata A complete example of json-file for a 5D (TCZYX) multiscales with 3 resolution levels could look like this: -```{literalinclude} examples/multiscales_strict/multiscales_example.json +```{literalinclude} examples/_build/multiscales/multiscales_example.json :language: json ``` ::: @@ -1424,17 +1424,16 @@ if not datasets: ### "omero" metadata (transitional) (omero-md)= -[=Transitional=] information specific to the channels of an image and how to render it can be found under the `omero` key in the group-level metadata: +Information specific to the channels of an image and how to render it +can be found under the `omero` key in the group-level metadata (i.e., under `"ome" > "omero"`): ```json -"id": 1, # ID in OMERO -"name": "example.tif", # Name as shown in the UI -"channels": [ # Array matching the c dimension size +"id": 1, // ID in OMERO +"name": "example.tif", // Name as shown in the UI +"channels": [ // Array matching the c dimension size { "active": true, - "coefficient": 1, "color": "0000FF", - "family": "linear", "inverted": false, "label": "LaminB1", "window": { @@ -1446,25 +1445,30 @@ if not datasets: } ], "rdefs": { - "defaultT": 0, # First timepoint to show the user - "defaultZ": 118, # First Z section to show the user - "model": "color" # "color" or "greyscale" + "defaultT": 0, // First timepoint to show the user + "defaultZ": 118, // First Z section to show the user + "model": "color" // "color" or "greyscale" } ``` -See the [OMERO WebGateway documentation](https://omero.readthedocs.io/en/stable/developers/Web/WebGateway.html#imgdata) -for more information. - The `omero` metadata is optional, but if present it MUST contain the field `channels`, which is an array of objects describing the channels of the image. -Each object in `channels` MUST contain the field `color`, -which is a string of 6 hexadecimal digits specifying the color of the channel in RGB format. -Each object in `channels` MUST contain the field `window`, -which is a object describing the windowing of the channel. -The field `window` MUST contain the fields `min` and `max`, -which are the minimum and maximum values of the window, respectively. -It MUST also contain the fields `start` and `end`, -which are the start and end values of the window, respectively. +The `channels` array length SHOULD correspond to the size of the respective channels axis, if present. +Each object in `channels` is optional and MAY contain the following fields: + +- `color` (string) String of 6 hexadecimal digits specifying the color of the channel in RGB format. +- `label` (string) Channel name. +- `active` (boolean) Indicates whether the channel should be displayed. +- `window` (dictionary) Values describing the windowing of the channel. + If provided, `start` and `end` values MUST be specified. + All values can be floating-point numbers, but will likely be integers for integer pixel types. + - `min` (float) Default setting for lower bound for values of `start` field. + MAY be used by viewers as the lower range of channel sliders. + - `max` (float) Default setting for upper bound for values of `end` field. + MAY be used by viewers as the upper range of channel sliders. + - `start` (float) Start of the rendering window. + - `end` (float) End of the rendering window. +- `inverted` (boolean) If true, the rendering of darkest to brightest pixels should be inverted. ### "labels" metadata (labels-md)= @@ -1556,7 +1560,7 @@ In the `zarr.json` under the image.zarr group, an explicit `identity` transform the coordinate system named `"physical"` in the multiscales metadata of the original image is the same as the coordinate system named `"physical"` in the multiscales metadata of the label image: -```{literalinclude} examples/multiscales_strict/multiscale_reference_to_label.json +```{literalinclude} examples/_build/multiscales/multiscales_reference_to_label.json :language: json ``` @@ -1580,7 +1584,7 @@ a coordinate system named `"physical"` serves as the "[intrinsic](#spec:hint:mul The `image-label` field contains information about the source image and display colors for the label image, i.e., a label image in which 0s and 1s represent intercellular and cellular space, respectively: -```{literalinclude} examples/label_strict/colors_properties.json +```{literalinclude} examples/_build/label/colors_properties.json :language: json ``` @@ -1659,14 +1663,14 @@ The `rowIndex`, `columnIndex`, and `path` MUST all refer to the same row/column For example the following JSON object defines a plate with two acquisitions and 6 wells (2 rows and 3 columns), containing up to 2 fields of view per acquisition. -```{literalinclude} examples/plate_strict/plate_6wells.json +```{literalinclude} examples/_build/plate/plate_6wells.json :language: json ``` The following JSON object defines a sparse plate with one acquisition and 2 wells in a 96 well plate, containing one field of view per acquisition. -```{literalinclude} examples/plate_strict/plate_2wells.json +```{literalinclude} examples/_build/plate/plate_2wells.json :language: json ``` ::: @@ -1695,14 +1699,14 @@ For example the following JSON object defines a well with four fields of view. The first two fields of view were part of the first acquisition while the last two fields of view were part of the second acquisition. -```{literalinclude} examples/well_strict/well_4fields.json +```{literalinclude} examples/_build/well/well_4fields.json :language: json ``` The following JSON object defines a well with two fields of view in a plate with four acquisitions. The first field is part of the first acquisition, and the second field is part of the last acquisition. -```{literalinclude} examples/well_strict/well_2fields.json +```{literalinclude} examples/_build/well/well_2fields.json :language: json ``` ::: @@ -1860,7 +1864,7 @@ If they do so, it is RECOMMENDED that the scene's first entry under the `coordin If no coordinate system is defined therein, but only in the respective linked multiscale groups, viewers may want to expose a choice for the user to select a coordinate system for display when opening the dataset for the first time. - + ``` @@ -1899,6 +1903,6 @@ Copyright © 2025 W3C® (MIT, ERCIM, Keio, Beihang). ```{toctree} :maxdepth: 1 -examples/index +examples/_build/index schemas/index ``` diff --git a/myst.yml b/myst.yml index 3e0e41a9..310cbc92 100644 --- a/myst.yml +++ b/myst.yml @@ -97,7 +97,7 @@ project: - file: index.md - file: examples/index.md children: - - pattern: examples/**/*.md + - pattern: examples/_build/**/*.md - file: schemas/index.md children: - pattern: schemas/*.md diff --git a/pre_build.py b/pre_build.py index 86a4d0d9..8f830c83 100644 --- a/pre_build.py +++ b/pre_build.py @@ -4,6 +4,7 @@ from pathlib import Path import jsonc as json import logging +from _version import __version__ # Suppress warnings from json-schema-for-humans about unresolvable URLs logging.getLogger().setLevel(logging.ERROR) @@ -12,11 +13,31 @@ os.chdir(os.path.dirname(os.path.abspath(__file__))) +def update_version_in_json(): + """Update the version in the JSON examples.""" + + examples_dir='examples' + json_files = glob.glob(os.path.join(examples_dir, '**', '*.json'), recursive=True) + for json_file in json_files: + with open(json_file, 'r') as f: + content = f.read() + # version is marked as "{{ VERSION }}" in the examples, + # so we can replace it with the actual version + content = content.replace('{{ VERSION }}', __version__) + + # store updated content to a different directory + # to avoid overwriting the original examples + + new_file_path = json_file.replace("_static", "_build") + os.makedirs(os.path.dirname(new_file_path), exist_ok=True) + with open(new_file_path, 'w') as f: + f.write(content) + def build_json_examples(): """Build markdown files from json examples.""" # glob recursively to find all json files - input_directory = 'examples' - output_directory = 'examples' + input_directory = 'examples/_build' + output_directory = 'examples/_build' os.makedirs(output_directory, exist_ok=True) # iterate over all folders in the examples directory @@ -87,14 +108,11 @@ def build_json_schemas(): """ for schema_file in schema_files: - if 'strict' in schema_file: - continue # skip strict schemas - print(f'Processing {schema_file}...') output_path_md = os.path.join(output_directory, f"{Path(schema_file).stem}" + ".md") output_path_html = os.path.join(output_directory, f"{Path(schema_file).stem}" + ".html") os.makedirs(os.path.dirname(output_path_md), exist_ok=True) - os.makedirs(os.path.dirname(output_path_html), exist_ok=True) + os.makedirs(os.path.dirname(output_path_html), exist_ok=True) # Generate the documentation try: @@ -198,6 +216,7 @@ def render_authors_md(): f.write(markdown_authors) +update_version_in_json() build_json_examples() build_json_schemas() build_footer() diff --git a/schemas/image.schema b/schemas/image.schema index 379b00f4..099f35d2 100644 --- a/schemas/image.schema +++ b/schemas/image.schema @@ -238,22 +238,20 @@ }, "required": [ "start", - "min", - "end", - "max" + "end" ] }, "label": { "type": "string" }, - "family": { - "type": "string" - }, "color": { "type": "string" }, "active": { "type": "boolean" + }, + "inverted": { + "type": "boolean" } } } diff --git a/schemas/strict_axes.schema b/schemas/strict_axes.schema deleted file mode 100644 index 70288fbc..00000000 --- a/schemas/strict_axes.schema +++ /dev/null @@ -1,30 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://ngff.openmicroscopy.org/0.6rc0/schemas/strict_axes.schema", - "title": "NGFF Strict Axes", - "description": "JSON from OME-NGFF .zattrs", - "allOf": [ - { - "$ref": "https://ngff.openmicroscopy.org/0.6rc0/schemas/axes.schema" - }, - { - "items": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "array", - "channel", - "time", - "space", - "displacement", - "coordinate", - "frequency" - ] - } - } - } - } - ] -} diff --git a/schemas/strict_coordinate_systems.schema b/schemas/strict_coordinate_systems.schema deleted file mode 100644 index 2f9c6372..00000000 --- a/schemas/strict_coordinate_systems.schema +++ /dev/null @@ -1,19 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://ngff.openmicroscopy.org/0.6rc0/schemas/strict_coordinate_systems.schema", - "allOf" : [ - { - "$ref": "coordinate_systems.schema" - }, - { - "items": { - "type": "object", - "properties": { - "axes": { - "$ref": "strict_axes.schema" - } - } - } - } - ] -} diff --git a/schemas/strict_image.schema b/schemas/strict_image.schema deleted file mode 100644 index cb8196ed..00000000 --- a/schemas/strict_image.schema +++ /dev/null @@ -1,26 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://ngff.openmicroscopy.org/0.6rc0/schemas/strict_image.schema", - "allOf": [ - { - "$ref": "https://ngff.openmicroscopy.org/0.6rc0/schemas/image.schema" - }, - { - "properties": { - "ome": { - "properties": { - "multiscales": { - "items": { - "required": [ - "metadata", - "type", - "name" - ] - } - } - } - } - } - } - ] -} diff --git a/schemas/strict_label.schema b/schemas/strict_label.schema deleted file mode 100644 index 50322e86..00000000 --- a/schemas/strict_label.schema +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://ngff.openmicroscopy.org/0.6rc0/schemas/strict_label.schema", - "allOf": [ - { - "$ref": "https://ngff.openmicroscopy.org/0.6rc0/schemas/label.schema" - }, - { - "properties": { - "ome": { - "properties": { - "image-label": { - "required": [ - "colors" - ] - } - } - } - } - } - ] -} diff --git a/schemas/strict_ome_zarr.schema b/schemas/strict_ome_zarr.schema deleted file mode 100644 index 25e75302..00000000 --- a/schemas/strict_ome_zarr.schema +++ /dev/null @@ -1,24 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://ngff.openmicroscopy.org/0.6rc0/schemas/strict_ome_zarr.schema", - "anyOf": [ - { - "$ref": "https://ngff.openmicroscopy.org/0.6rc0/schemas/bf2raw.schema" - }, - { - "$ref": "https://ngff.openmicroscopy.org/0.6rc0/schemas/strict_image.schema" - }, - { - "$ref": "https://ngff.openmicroscopy.org/0.6rc0/schemas/strict_label.schema" - }, - { - "$ref": "https://ngff.openmicroscopy.org/0.6rc0/schemas/ome.schema" - }, - { - "$ref": "https://ngff.openmicroscopy.org/0.6rc0/schemas/strict_plate.schema" - }, - { - "$ref": "https://ngff.openmicroscopy.org/0.6rc0/schemas/strict_well.schema" - } - ] -} diff --git a/schemas/strict_plate.schema b/schemas/strict_plate.schema deleted file mode 100644 index 0a23bb36..00000000 --- a/schemas/strict_plate.schema +++ /dev/null @@ -1,32 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://ngff.openmicroscopy.org/0.6rc0/schemas/strict_plate.schema", - "allOf": [ - { - "$ref": "https://ngff.openmicroscopy.org/0.6rc0/schemas/plate.schema" - }, - { - "properties": { - "ome": { - "properties": { - "plate": { - "properties": { - "acquisitions": { - "items": { - "required": [ - "name", - "maximumfieldcount" - ] - } - } - }, - "required": [ - "name" - ] - } - } - } - } - } - ] -} diff --git a/schemas/strict_well.schema b/schemas/strict_well.schema deleted file mode 100644 index 004860ea..00000000 --- a/schemas/strict_well.schema +++ /dev/null @@ -1,5 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://ngff.openmicroscopy.org/0.6rc0/schemas/strict_well.schema", - "$ref": "https://ngff.openmicroscopy.org/0.6rc0/schemas/well.schema" -} diff --git a/tests/attributes/spec/invalid/image/invalid_channels_color.json b/tests/attributes/spec/invalid/image/invalid_channels_color.json index 2521d6cc..a1974bc2 100644 --- a/tests/attributes/spec/invalid/image/invalid_channels_color.json +++ b/tests/attributes/spec/invalid/image/invalid_channels_color.json @@ -42,9 +42,7 @@ "channels": [ { "active": true, - "coefficient": 1.0, "color": 255, - "family": "linear", "label": "1234", "window": { "end": 1765.0, diff --git a/tests/attributes/spec/invalid/image/invalid_channels_window.json b/tests/attributes/spec/invalid/image/invalid_channels_window.json index f915eaad..bf394f94 100644 --- a/tests/attributes/spec/invalid/image/invalid_channels_window.json +++ b/tests/attributes/spec/invalid/image/invalid_channels_window.json @@ -42,9 +42,7 @@ "channels": [ { "active": true, - "coefficient": 1.0, "color": "ff0000", - "family": "linear", "label": "1234", "window": { "end": "100", diff --git a/tests/attributes/strict/valid/image/image.json b/tests/attributes/spec/invalid/omero/missing_channels.json similarity index 66% rename from tests/attributes/strict/valid/image/image.json rename to tests/attributes/spec/invalid/omero/missing_channels.json index 8606c08c..7c5b7b58 100644 --- a/tests/attributes/strict/valid/image/image.json +++ b/tests/attributes/spec/invalid/omero/missing_channels.json @@ -1,12 +1,17 @@ { "ome": { - "version": "0.6rc0", + "version": "0.6.dev3", "multiscales": [ { "coordinateSystems": [ { "name": "physical", "axes": [ + { + "name": "z", + "type": "space", + "unit": "micrometer" + }, { "name": "y", "type": "space", @@ -26,28 +31,26 @@ "coordinateTransformations": [ { "scale": [ + 1, 1, 1 ], - "type": "scale", - "input": {"path": "s0"}, - "output": {"name": "physical"} + "input": "s0", + "output": "physical", + "type": "scale" } ] } - ], - "name": "simple_image", - "type": "foo", - "metadata": { - "key": "value" - } + ] } - ] + ], + "omero": { + } }, "_conformance": { "schema": { - "id": "schemas/strict_image.schema" + "id": "schemas/image.schema" }, - "strict": true + "valid": false } } \ No newline at end of file diff --git a/tests/attributes/spec/invalid/omero/missing_start_end.json b/tests/attributes/spec/invalid/omero/missing_start_end.json new file mode 100644 index 00000000..8778a74c --- /dev/null +++ b/tests/attributes/spec/invalid/omero/missing_start_end.json @@ -0,0 +1,88 @@ +{ + "ome": { + "version": "0.6.dev3", + "multiscales": [ + { + "coordinateSystems": [ + { + "name": "physical", + "axes": [ + { + "name": "z", + "type": "space", + "unit": "micrometer" + }, + { + "name": "y", + "type": "space", + "unit": "micrometer" + }, + { + "name": "x", + "type": "space", + "unit": "micrometer" + } + ] + } + ], + "datasets": [ + { + "path": "s0", + "coordinateTransformations": [ + { + "scale": [ + 1, + 1, + 1 + ], + "input": "s0", + "output": "physical", + "type": "scale" + } + ] + } + ] + } + ], + "omero": { + "channels": [ + { + "label": "Channel:0", + "color": "ff0000", + "active": true, + "inverted": false, + "window": { + "min": 0, + "max": 255 + } + }, + { + "label": "Channel:1", + "color": "00ff00", + "active": true, + "inverted": true, + "window": { + "min": 0, + "max": 255 + } + }, + { + "label": "Channel:2", + "color": "0000ff", + "active": true, + "inverted": false, + "window": { + "min": 0, + "max": 255 + } + } + ] + } + }, + "_conformance": { + "schema": { + "id": "schemas/image.schema" + }, + "valid": false + } +} \ No newline at end of file diff --git a/tests/attributes/spec/valid/omero/full_omero_metadata.json b/tests/attributes/spec/valid/omero/full_omero_metadata.json new file mode 100644 index 00000000..77d3a029 --- /dev/null +++ b/tests/attributes/spec/valid/omero/full_omero_metadata.json @@ -0,0 +1,93 @@ +{ + "ome": { + "version": "0.6rc0", + "multiscales": [ + { + "coordinateSystems": [ + { + "name": "physical", + "axes": [ + { + "name": "z", + "type": "space", + "unit": "micrometer" + }, + { + "name": "y", + "type": "space", + "unit": "micrometer" + }, + { + "name": "x", + "type": "space", + "unit": "micrometer" + } + ] + } + ], + "datasets": [ + { + "path": "s0", + "coordinateTransformations": [ + { + "scale": [ + 1, + 1, + 1 + ], + "input": {"path": "s0"}, + "output": {"name": "physical"}, + "type": "scale" + } + ] + } + ] + } + ], + "omero": { + "channels": [ + { + "label": "Channel:0", + "color": "ff0000", + "active": true, + "inverted": false, + "window": { + "min": 0, + "start": 100, + "end": 200, + "max": 255 + } + }, + { + "label": "Channel:1", + "color": "00ff00", + "active": true, + "inverted": true, + "window": { + "min": 0, + "start": 50, + "end": 150, + "max": 255 + } + }, + { + "label": "Channel:2", + "color": "0000ff", + "active": true, + "inverted": false, + "window": { + "min": 0, + "start": 25, + "end": 125, + "max": 255 + } + } + ] + } + }, + "_conformance": { + "schema": { + "id": "schemas/image.schema" + } + } +} \ No newline at end of file diff --git a/tests/attributes/strict/invalid/label/no_colors.json b/tests/attributes/strict/invalid/label/no_colors.json deleted file mode 100644 index de107479..00000000 --- a/tests/attributes/strict/invalid/label/no_colors.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "ome": { - "version": "0.6rc0", - "image-label": {} - }, - "_conformance": { - "schema": { - "id": "schemas/strict_label.schema" - }, - "description": "Tests for the strict image-label JSON schema: ", - "valid": false, - "strict": true - } -} \ No newline at end of file diff --git a/tests/attributes/strict/invalid/plate/missing_acquisition_maximumfieldcount.json b/tests/attributes/strict/invalid/plate/missing_acquisition_maximumfieldcount.json deleted file mode 100644 index c84e1252..00000000 --- a/tests/attributes/strict/invalid/plate/missing_acquisition_maximumfieldcount.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "ome": { - "version": "0.6rc02", - "plate": { - "acquisitions": [ - { - "id": 0, - "name": "0" - } - ], - "columns": [ - { - "name": "A" - } - ], - "name": "test plate", - "rows": [ - { - "name": "1" - } - ], - "wells": [ - { - "path": "A/1", - "rowIndex": 0, - "columnIndex": 0 - } - ] - } - }, - "_conformance": { - "schema": { - "id": "schemas/strict_plate.schema" - }, - "description": "Tests for the strict plate JSON schema: ", - "valid": false, - "strict": true - } -} \ No newline at end of file diff --git a/tests/attributes/strict/invalid/plate/missing_acquisition_name.json b/tests/attributes/strict/invalid/plate/missing_acquisition_name.json deleted file mode 100644 index fcf1204f..00000000 --- a/tests/attributes/strict/invalid/plate/missing_acquisition_name.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "ome": { - "version": "0.6rc0", - "plate": { - "acquisitions": [ - { - "id": 0, - "maximumfieldcount": 1 - } - ], - "columns": [ - { - "name": "A" - } - ], - "name": "test plate", - "rows": [ - { - "name": "1" - } - ], - "wells": [ - { - "path": "A/1", - "rowIndex": 0, - "columnIndex": 0 - } - ] - } - }, - "_conformance": { - "schema": { - "id": "schemas/strict_plate.schema" - }, - "description": "Tests for the strict plate JSON schema: ", - "valid": false, - "strict": true - } -} \ No newline at end of file diff --git a/tests/attributes/strict/invalid/plate/missing_name.json b/tests/attributes/strict/invalid/plate/missing_name.json deleted file mode 100644 index 61631838..00000000 --- a/tests/attributes/strict/invalid/plate/missing_name.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "ome": { - "version": "0.6rc02", - "plate": { - "columns": [ - { - "name": "A" - } - ], - "rows": [ - { - "name": "1" - } - ], - "wells": [ - { - "path": "A/1", - "rowIndex": 0, - "columnIndex": 0 - } - ] - } - }, - "_conformance": { - "schema": { - "id": "schemas/strict_plate.schema" - }, - "description": "Tests for the strict plate JSON schema: ", - "valid": false, - "strict": true - } -} \ No newline at end of file diff --git a/tests/attributes/strict/valid/image/image_metadata.json b/tests/attributes/strict/valid/image/image_metadata.json deleted file mode 100644 index b081fd9e..00000000 --- a/tests/attributes/strict/valid/image/image_metadata.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "ome": { - "version": "0.6rc0", - "@id": "top", - "@type": "ngff:Image", - "multiscales": [ - { - "@id": "inner", - "name": "example", - "datasets": [ - { - "path": "path/to/0", - "coordinateTransformations": [ - { - "type": "scale", - "scale": [ - 1, - 1 - ], - "input": {"path": "path/to/0"}, - "output": {"name": "physical"} - } - ] - } - ], - "type": "gaussian", - "metadata": { - "method": "skimage.transform.pyramid_gaussian", - "version": "0.16.1", - "args": [ - "true", - "false" - ], - "kwargs": { - "multichannel": true - } - }, - "coordinateSystems": [ - { - "name": "physical", - "axes": [ - { - "name": "y", - "type": "space", - "unit": "micrometer" - }, - { - "name": "x", - "type": "space", - "unit": "micrometer" - } - ] - } - ] - } - ] - }, - "_conformance": { - "schema": { - "id": "schemas/strict_image.schema" - }, - "strict": true - } -} \ No newline at end of file diff --git a/tests/attributes/strict/valid/image/image_omero.json b/tests/attributes/strict/valid/image/image_omero.json deleted file mode 100644 index c61a7d70..00000000 --- a/tests/attributes/strict/valid/image/image_omero.json +++ /dev/null @@ -1,167 +0,0 @@ -{ - "ome": { - "version": "0.6rc0", - "multiscales": [ - { - "coordinateSystems": [ - { - "name": "world", - "axes": [ - { - "name": "t", - "type": "time" - }, - { - "name": "c", - "type": "channel" - }, - { - "name": "z", - "type": "space", - "unit": "micrometer" - }, - { - "name": "y", - "type": "space", - "unit": "micrometer" - }, - { - "name": "x", - "type": "space", - "unit": "micrometer" - } - ] - }, - { - "name": "physical", - "axes": [ - { - "name": "t", - "type": "time" - }, - { - "name": "c", - "type": "channel" - }, - { - "name": "z", - "type": "space", - "unit": "micrometer" - }, - { - "name": "y", - "type": "space", - "unit": "micrometer" - }, - { - "name": "x", - "type": "space", - "unit": "micrometer" - } - ] - } - ], - "datasets": [ - { - "path": "s0", - "coordinateTransformations": [ - { - "scale": [ - 1, - 1, - 0.5, - 0.13, - 0.13 - ], - "type": "scale", - "input": {"path": "s0"}, - "output": {"name": "physical"} - } - ] - }, - { - "path": "s1", - "coordinateTransformations": [ - { - "scale": [ - 1, - 1, - 1, - 0.26, - 0.26 - ], - "type": "scale", - "input": {"path": "s1"}, - "output": {"name": "physical"} - } - ] - } - ], - "coordinateTransformations": [ - { - "translation": [ - 0, - 9, - 0.5, - 25.74, - 21.58 - ], - "type": "translation", - "input": {"name": "intrinsic"}, - "output": {"name": "world"} - } - ], - "name": "image_with_omero_metadata", - "type": "foo", - "metadata": { - "key": "value" - } - } - ], - "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.6rc0" - } - }, - "_conformance": { - "schema": { - "id": "schemas/strict_image.schema" - }, - "strict": true - } -} \ No newline at end of file diff --git a/tests/attributes/strict/valid/image/multiscales_example.json b/tests/attributes/strict/valid/image/multiscales_example.json deleted file mode 100644 index 34fce6b1..00000000 --- a/tests/attributes/strict/valid/image/multiscales_example.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "ome": { - "version": "0.6rc0", - "multiscales": [ - { - "name": "example", - "coordinateSystems": [ - { - "name": "world", - "axes": [ - { - "name": "t", - "type": "time", - "unit": "millisecond" - }, - { - "name": "c", - "type": "channel" - }, - { - "name": "z", - "type": "space", - "unit": "micrometer" - }, - { - "name": "y", - "type": "space", - "unit": "micrometer" - }, - { - "name": "x", - "type": "space", - "unit": "micrometer" - } - ] - }, - { - "name": "intrinsic", - "axes": [ - { - "name": "t", - "type": "time", - "unit": "millisecond" - }, - { - "name": "c", - "type": "channel" - }, - { - "name": "z", - "type": "space", - "unit": "micrometer" - }, - { - "name": "y", - "type": "space", - "unit": "micrometer" - }, - { - "name": "x", - "type": "space", - "unit": "micrometer" - } - ] - } - ], - "datasets": [ - { - "path": "s0", - "coordinateTransformations": [ - { - "type": "scale", - "scale": [ - 1.0, - 1.0, - 0.5, - 0.5, - 0.5 - ], - "input": {"path": "s0"}, - "output": {"name": "intrinsic"} - } - ] - }, - { - "path": "1", - "coordinateTransformations": [ - { - "type": "scale", - "scale": [ - 1.0, - 1.0, - 1.0, - 1.0, - 1.0 - ], - "input": {"path": "s1"}, - "output": {"name": "intrinsic"} - } - ] - }, - { - "path": "s2", - "coordinateTransformations": [ - { - "type": "scale", - "scale": [ - 1.0, - 1.0, - 2.0, - 2.0, - 2.0 - ], - "input": {"path": "s2"}, - "output": {"name": "intrinsic"} - } - ] - } - ], - "coordinateTransformations": [ - { - "type": "scale", - "scale": [ - 0.1, - 1.0, - 1.0, - 1.0, - 1.0 - ], - "input": {"name": "world"}, - "output": {"name": "intrinsic"} - } - ], - "type": "gaussian", - "metadata": { - "description": "the fields in metadata depend on the downscaling implementation. Here, the parameters passed to the skimage function are given", - "method": "skimage.transform.pyramid_gaussian", - "version": "0.16.1", - "args": "[true]", - "kwargs": { - "multichannel": true - } - } - } - ] - }, - "_conformance": { - "schema": { - "id": "schemas/strict_image.schema" - }, - "strict": true - } -} \ No newline at end of file diff --git a/tests/attributes/strict/valid/image/multiscales_transformations.json b/tests/attributes/strict/valid/image/multiscales_transformations.json deleted file mode 100644 index ecd09381..00000000 --- a/tests/attributes/strict/valid/image/multiscales_transformations.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "ome": { - "version": "0.6rc0", - "multiscales": [ - { - "coordinateSystems": [ - { - "name": "world", - "axes": [ - { - "name": "y", - "type": "space", - "unit": "micrometer" - }, - { - "name": "x", - "type": "space", - "unit": "micrometer" - } - ] - }, - { - "name": "physical", - "axes": [ - { - "name": "y", - "type": "space", - "unit": "micrometer" - }, - { - "name": "x", - "type": "space", - "unit": "micrometer" - } - ] - } - ], - "datasets": [ - { - "path": "s0", - "coordinateTransformations": [ - { - "scale": [ - 1, - 1 - ], - "type": "scale", - "input": {"path": "s0"}, - "output": {"name": "physical"} - } - ] - } - ], - "coordinateTransformations": [ - { - "scale": [ - 10, - 10 - ], - "type": "scale", - "input": {"name": "physical"}, - "output": {"name": "world"} - } - ], - "name": "image_with_coordinateTransformations", - "type": "foo", - "metadata": { - "key": "value" - } - } - ] - }, - "_conformance": { - "schema": { - "id": "schemas/strict_image.schema" - }, - "strict": true - } -} \ No newline at end of file diff --git a/tests/attributes/strict/valid/plate/strict_acquisitions.json b/tests/attributes/strict/valid/plate/strict_acquisitions.json deleted file mode 100644 index 16520059..00000000 --- a/tests/attributes/strict/valid/plate/strict_acquisitions.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "ome": { - "version": "0.6rc0", - "plate": { - "acquisitions": [ - { - "id": 0, - "name": "0", - "maximumfieldcount": 1 - } - ], - "columns": [ - { - "name": "A" - } - ], - "name": "test plate", - "rows": [ - { - "name": "1" - } - ], - "wells": [ - { - "path": "A/1", - "rowIndex": 0, - "columnIndex": 0 - } - ] - } - }, - "_conformance": { - "schema": { - "id": "schemas/strict_plate.schema" - }, - "description": "Tests for the strict plate JSON schema: ", - "strict": true - } -} \ No newline at end of file diff --git a/tests/attributes/strict/valid/plate/strict_no_acquisitions.json b/tests/attributes/strict/valid/plate/strict_no_acquisitions.json deleted file mode 100644 index c531aca2..00000000 --- a/tests/attributes/strict/valid/plate/strict_no_acquisitions.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "ome": { - "version": "0.6rc0", - "plate": { - "columns": [ - { - "name": "A" - } - ], - "name": "test plate", - "rows": [ - { - "name": "1" - } - ], - "wells": [ - { - "path": "A/1", - "rowIndex": 0, - "columnIndex": 0 - } - ] - } - }, - "_conformance": { - "schema": { - "id": "schemas/strict_plate.schema" - }, - "description": "Tests for the strict plate JSON schema: ", - "strict": true - } -} \ No newline at end of file diff --git a/tests/attributes/strict/valid/well/strict_acquisitions.json b/tests/attributes/strict/valid/well/strict_acquisitions.json deleted file mode 100644 index 841a6929..00000000 --- a/tests/attributes/strict/valid/well/strict_acquisitions.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "ome": { - "version": "0.6rc0", - "well": { - "images": [ - { - "acquisition": 0, - "path": "0" - } - ] - } - }, - "_conformance": { - "schema": { - "id": "schemas/strict_well.schema" - }, - "description": "Tests for the strict well JSON schema: ", - "strict": true - } -} \ No newline at end of file diff --git a/tests/attributes/strict/valid/well/strict_no_acquisitions.json b/tests/attributes/strict/valid/well/strict_no_acquisitions.json deleted file mode 100644 index 58bfe147..00000000 --- a/tests/attributes/strict/valid/well/strict_no_acquisitions.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "ome": { - "version": "0.6rc0", - "well": { - "images": [ - { - "path": "0" - } - ] - } - }, - "_conformance": { - "schema": { - "id": "schemas/strict_well.schema" - }, - "description": "Tests for the strict well JSON schema: ", - "strict": true - } -} \ No newline at end of file diff --git a/tests/test_attributes.py b/tests/test_attributes.py index 8e1e51b1..974fa9b8 100644 --- a/tests/test_attributes.py +++ b/tests/test_attributes.py @@ -1,10 +1,10 @@ +import json from pathlib import Path from typing import Any -import json import pytest - -from jsonschema import RefResolver, Draft202012Validator as Validator +from jsonschema import Draft202012Validator as Validator +from jsonschema import RefResolver from jsonschema.exceptions import ValidationError here = Path(__file__).resolve().parent @@ -24,9 +24,6 @@ GENERIC_SCHEMA = schema_store[ f"https://ngff.openmicroscopy.org/{version}/schemas/ome_zarr.schema" ] -STRICT_SCHEMA = schema_store[ - f"https://ngff.openmicroscopy.org/{version}/schemas/strict_ome_zarr.schema" -] case_fnames = sorted(attrs_dir.rglob("*.json")) @@ -46,22 +43,16 @@ def test_attributes(case_fname: Path): conformance = case_obj.get("_conformance", {}) valid = conformance.get("valid", True) - strict = conformance.get("strict", False) - - if strict: - schema = STRICT_SCHEMA - else: - schema = GENERIC_SCHEMA resolver = RefResolver.from_schema( - schema, + GENERIC_SCHEMA, store=schema_store, ) validator_cls = Validator validator = validator_cls( - schema, + GENERIC_SCHEMA, resolver=resolver, ) diff --git a/tests/test_validation.py b/tests/test_validation.py index 1f38f354..923208f4 100644 --- a/tests/test_validation.py +++ b/tests/test_validation.py @@ -1,21 +1,19 @@ -import json import glob +import json import os - from dataclasses import dataclass -from typing import List +from pathlib import Path import pytest - -from jsonschema import RefResolver, Draft202012Validator as Validator +from jsonschema import Draft202012Validator as Validator +from jsonschema import RefResolver from jsonschema.exceptions import ValidationError -from pathlib import Path os.chdir(Path(__file__).parent.parent) schema_store = {} for schema_filename in glob.glob("schemas/*"): - if schema_filename.endswith('.schema'): + if schema_filename.endswith(".schema"): with open(schema_filename) as f: schema = json.load(f) schema_store[schema["$id"]] = schema @@ -23,9 +21,6 @@ GENERIC_SCHEMA = schema_store[ "https://ngff.openmicroscopy.org/0.6rc0/schemas/ome_zarr.schema" ] -GENERIC_STRICT_SCHEMA = schema_store[ - "https://ngff.openmicroscopy.org/0.6rc0/schemas/strict_ome_zarr.schema" -] @dataclass @@ -65,8 +60,8 @@ def pytest_generate_tests(metafunc): if "suite" not in metafunc.fixturenames: return - suites: List[Suite] = [] - ids: List[str] = [] + suites: list[Suite] = [] + ids: list[str] = [] # Validation for filename in glob.glob("tests/*.json"): @@ -127,8 +122,8 @@ def test_example_configs(): if has_examples and not has_config: missing.append(subdir[0]) if missing: - raise Exception(f"Directories missing configs: {missing}") + raise FileNotFoundError(f"Directories missing configs: {missing}") -if __name__ == '__main__': - pytest.main([__file__]) \ No newline at end of file +if __name__ == "__main__": + pytest.main([__file__]) diff --git a/tests/zarr/spec/invalid/image/invalid_channels_color.ome.zarr/zarr.json b/tests/zarr/spec/invalid/image/invalid_channels_color.ome.zarr/zarr.json index cd5a8f3e..f6b2632a 100644 --- a/tests/zarr/spec/invalid/image/invalid_channels_color.ome.zarr/zarr.json +++ b/tests/zarr/spec/invalid/image/invalid_channels_color.ome.zarr/zarr.json @@ -45,9 +45,7 @@ "channels": [ { "active": true, - "coefficient": 1.0, "color": 255, - "family": "linear", "label": "1234", "window": { "end": 1765.0, diff --git a/tests/zarr/spec/invalid/image/invalid_channels_window.ome.zarr/zarr.json b/tests/zarr/spec/invalid/image/invalid_channels_window.ome.zarr/zarr.json index 0c1f59cf..9384f149 100644 --- a/tests/zarr/spec/invalid/image/invalid_channels_window.ome.zarr/zarr.json +++ b/tests/zarr/spec/invalid/image/invalid_channels_window.ome.zarr/zarr.json @@ -45,9 +45,7 @@ "channels": [ { "active": true, - "coefficient": 1.0, "color": "ff0000", - "family": "linear", "label": "1234", "window": { "end": "100", diff --git a/tests/zarr/strict/invalid/label/no_colors.ome.zarr/zarr.json b/tests/zarr/strict/invalid/label/no_colors.ome.zarr/zarr.json deleted file mode 100644 index cedf31b6..00000000 --- a/tests/zarr/strict/invalid/label/no_colors.ome.zarr/zarr.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "zarr_format": 3, - "node_type": "group", - "attributes": { - "ome": { - "version": "0.6rc0", - "image-label": {} - }, - "_conformance": { - "schema": { - "id": "schemas/strict_label.schema" - }, - "description": "Tests for the strict image-label JSON schema: ", - "valid": false - } - } -} \ No newline at end of file diff --git a/tests/zarr/strict/invalid/plate/missing_acquisition_maximumfieldcount.ome.zarr/zarr.json b/tests/zarr/strict/invalid/plate/missing_acquisition_maximumfieldcount.ome.zarr/zarr.json deleted file mode 100644 index d25d7075..00000000 --- a/tests/zarr/strict/invalid/plate/missing_acquisition_maximumfieldcount.ome.zarr/zarr.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "zarr_format": 3, - "node_type": "group", - "attributes": { - "ome": { - "version": "0.6rc0", - "plate": { - "acquisitions": [ - { - "id": 0, - "name": "0" - } - ], - "columns": [ - { - "name": "A" - } - ], - "name": "test plate", - "rows": [ - { - "name": "1" - } - ], - "wells": [ - { - "path": "A/1", - "rowIndex": 0, - "columnIndex": 0 - } - ] - } - }, - "_conformance": { - "schema": { - "id": "schemas/strict_plate.schema" - }, - "description": "Tests for the strict plate JSON schema: ", - "valid": false - } - } -} \ No newline at end of file diff --git a/tests/zarr/strict/invalid/plate/missing_acquisition_name.ome.zarr/zarr.json b/tests/zarr/strict/invalid/plate/missing_acquisition_name.ome.zarr/zarr.json deleted file mode 100644 index bc04d4e3..00000000 --- a/tests/zarr/strict/invalid/plate/missing_acquisition_name.ome.zarr/zarr.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "zarr_format": 3, - "node_type": "group", - "attributes": { - "ome": { - "version": "0.6rc0", - "plate": { - "acquisitions": [ - { - "id": 0, - "maximumfieldcount": 1 - } - ], - "columns": [ - { - "name": "A" - } - ], - "name": "test plate", - "rows": [ - { - "name": "1" - } - ], - "wells": [ - { - "path": "A/1", - "rowIndex": 0, - "columnIndex": 0 - } - ] - } - }, - "_conformance": { - "schema": { - "id": "schemas/strict_plate.schema" - }, - "description": "Tests for the strict plate JSON schema: ", - "valid": false - } - } -} \ No newline at end of file diff --git a/tests/zarr/strict/invalid/plate/missing_name.ome.zarr/zarr.json b/tests/zarr/strict/invalid/plate/missing_name.ome.zarr/zarr.json deleted file mode 100644 index 29074140..00000000 --- a/tests/zarr/strict/invalid/plate/missing_name.ome.zarr/zarr.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "zarr_format": 3, - "node_type": "group", - "attributes": { - "ome": { - "version": "0.6rc0", - "plate": { - "columns": [ - { - "name": "A" - } - ], - "rows": [ - { - "name": "1" - } - ], - "wells": [ - { - "path": "A/1", - "rowIndex": 0, - "columnIndex": 0 - } - ] - } - }, - "_conformance": { - "schema": { - "id": "schemas/strict_plate.schema" - }, - "description": "Tests for the strict plate JSON schema: ", - "valid": false - } - } -} \ No newline at end of file diff --git a/tests/zarr/strict/valid/image/image.ome.zarr/zarr.json b/tests/zarr/strict/valid/image/image.ome.zarr/zarr.json deleted file mode 100644 index 0d22914c..00000000 --- a/tests/zarr/strict/valid/image/image.ome.zarr/zarr.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "zarr_format": 3, - "node_type": "group", - "attributes": { - "ome": { - "version": "0.6rc0", - "multiscales": [ - { - "coordinateSystems": [ - { - "name": "physical", - "axes": [ - { - "name": "y", - "type": "space", - "unit": "micrometer" - }, - { - "name": "x", - "type": "space", - "unit": "micrometer" - } - ] - } - ], - "datasets": [ - { - "path": "0", - "coordinateTransformations": [ - { - "scale": [ - 1, - 1 - ], - "type": "scale", - "input": "0", - "output": "physical" - } - ] - } - ], - "name": "simple_image", - "type": "foo", - "metadata": { - "key": "value" - } - } - ] - }, - "_conformance": { - "schema": { - "id": "schemas/strict_image.schema" - } - } - } -} \ No newline at end of file diff --git a/tests/zarr/strict/valid/image/image_metadata.ome.zarr/zarr.json b/tests/zarr/strict/valid/image/image_metadata.ome.zarr/zarr.json deleted file mode 100644 index 1bd58af9..00000000 --- a/tests/zarr/strict/valid/image/image_metadata.ome.zarr/zarr.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "zarr_format": 3, - "node_type": "group", - "attributes": { - "ome": { - "version": "0.6rc0", - "@id": "top", - "@type": "ngff:Image", - "multiscales": [ - { - "@id": "inner", - "name": "example", - "datasets": [ - { - "path": "path/to/0", - "coordinateTransformations": [ - { - "type": "scale", - "scale": [ - 1, - 1 - ], - "input": "path/to/0", - "output": "physical" - } - ] - } - ], - "type": "gaussian", - "metadata": { - "method": "skimage.transform.pyramid_gaussian", - "version": "0.16.1", - "args": [ - "true", - "false" - ], - "kwargs": { - "multichannel": true - } - }, - "coordinateSystems": [ - { - "name": "physical", - "axes": [ - { - "name": "y", - "type": "space", - "unit": "micrometer" - }, - { - "name": "x", - "type": "space", - "unit": "micrometer" - } - ] - } - ] - } - ] - }, - "_conformance": { - "schema": { - "id": "schemas/strict_image.schema" - } - } - } -} \ No newline at end of file diff --git a/tests/zarr/strict/valid/image/image_omero.ome.zarr/zarr.json b/tests/zarr/strict/valid/image/image_omero.ome.zarr/zarr.json deleted file mode 100644 index e8222896..00000000 --- a/tests/zarr/strict/valid/image/image_omero.ome.zarr/zarr.json +++ /dev/null @@ -1,170 +0,0 @@ -{ - "zarr_format": 3, - "node_type": "group", - "attributes": { - "ome": { - "version": "0.6rc0", - "multiscales": [ - { - "coordinateSystems": [ - { - "name": "world", - "axes": [ - { - "name": "t", - "type": "time" - }, - { - "name": "c", - "type": "channel" - }, - { - "name": "z", - "type": "space", - "unit": "micrometer" - }, - { - "name": "y", - "type": "space", - "unit": "micrometer" - }, - { - "name": "x", - "type": "space", - "unit": "micrometer" - } - ] - }, - { - "name": "physical", - "axes": [ - { - "name": "t", - "type": "time" - }, - { - "name": "c", - "type": "channel" - }, - { - "name": "z", - "type": "space", - "unit": "micrometer" - }, - { - "name": "y", - "type": "space", - "unit": "micrometer" - }, - { - "name": "x", - "type": "space", - "unit": "micrometer" - } - ] - } - ], - "datasets": [ - { - "path": "0", - "coordinateTransformations": [ - { - "scale": [ - 1, - 1, - 0.5, - 0.13, - 0.13 - ], - "type": "scale", - "input": "0", - "output": "physical" - } - ] - }, - { - "path": "1", - "coordinateTransformations": [ - { - "scale": [ - 1, - 1, - 1, - 0.26, - 0.26 - ], - "type": "scale", - "input": "1", - "output": "physical" - } - ] - } - ], - "coordinateTransformations": [ - { - "translation": [ - 0, - 9, - 0.5, - 25.74, - 21.58 - ], - "type": "translation", - "input": "intrinsic", - "output": "world" - } - ], - "name": "image_with_omero_metadata", - "type": "foo", - "metadata": { - "key": "value" - } - } - ], - "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.6rc0" - } - }, - "_conformance": { - "schema": { - "id": "schemas/strict_image.schema" - } - } - } -} \ No newline at end of file diff --git a/tests/zarr/strict/valid/image/multiscales_example.ome.zarr/zarr.json b/tests/zarr/strict/valid/image/multiscales_example.ome.zarr/zarr.json deleted file mode 100644 index e9c87a85..00000000 --- a/tests/zarr/strict/valid/image/multiscales_example.ome.zarr/zarr.json +++ /dev/null @@ -1,156 +0,0 @@ -{ - "zarr_format": 3, - "node_type": "group", - "attributes": { - "ome": { - "version": "0.6rc0", - "multiscales": [ - { - "name": "example", - "coordinateSystems": [ - { - "name": "world", - "axes": [ - { - "name": "t", - "type": "time", - "unit": "millisecond" - }, - { - "name": "c", - "type": "channel" - }, - { - "name": "z", - "type": "space", - "unit": "micrometer" - }, - { - "name": "y", - "type": "space", - "unit": "micrometer" - }, - { - "name": "x", - "type": "space", - "unit": "micrometer" - } - ] - }, - { - "name": "intrinsic", - "axes": [ - { - "name": "t", - "type": "time", - "unit": "millisecond" - }, - { - "name": "c", - "type": "channel" - }, - { - "name": "z", - "type": "space", - "unit": "micrometer" - }, - { - "name": "y", - "type": "space", - "unit": "micrometer" - }, - { - "name": "x", - "type": "space", - "unit": "micrometer" - } - ] - } - ], - "datasets": [ - { - "path": "0", - "coordinateTransformations": [ - { - "type": "scale", - "scale": [ - 1.0, - 1.0, - 0.5, - 0.5, - 0.5 - ], - "input": "0", - "output": "intrinsic" - } - ] - }, - { - "path": "1", - "coordinateTransformations": [ - { - "type": "scale", - "scale": [ - 1.0, - 1.0, - 1.0, - 1.0, - 1.0 - ], - "input": "1", - "output": "intrinsic" - } - ] - }, - { - "path": "2", - "coordinateTransformations": [ - { - "type": "scale", - "scale": [ - 1.0, - 1.0, - 2.0, - 2.0, - 2.0 - ], - "input": "2", - "output": "intrinsic" - } - ] - } - ], - "coordinateTransformations": [ - { - "type": "scale", - "scale": [ - 0.1, - 1.0, - 1.0, - 1.0, - 1.0 - ], - "input": "world", - "output": "intrinsic" - } - ], - "type": "gaussian", - "metadata": { - "description": "the fields in metadata depend on the downscaling implementation. Here, the parameters passed to the skimage function are given", - "method": "skimage.transform.pyramid_gaussian", - "version": "0.16.1", - "args": "[true]", - "kwargs": { - "multichannel": true - } - } - } - ] - }, - "_conformance": { - "schema": { - "id": "schemas/strict_image.schema" - } - } - } -} \ No newline at end of file diff --git a/tests/zarr/strict/valid/image/multiscales_transformations.ome.zarr/zarr.json b/tests/zarr/strict/valid/image/multiscales_transformations.ome.zarr/zarr.json deleted file mode 100644 index eb562ead..00000000 --- a/tests/zarr/strict/valid/image/multiscales_transformations.ome.zarr/zarr.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "zarr_format": 3, - "node_type": "group", - "attributes": { - "ome": { - "version": "0.6rc0", - "multiscales": [ - { - "coordinateSystems": [ - { - "name": "world", - "axes": [ - { - "name": "y", - "type": "space", - "unit": "micrometer" - }, - { - "name": "x", - "type": "space", - "unit": "micrometer" - } - ] - }, - { - "name": "physical", - "axes": [ - { - "name": "y", - "type": "space", - "unit": "micrometer" - }, - { - "name": "x", - "type": "space", - "unit": "micrometer" - } - ] - } - ], - "datasets": [ - { - "path": "0", - "coordinateTransformations": [ - { - "scale": [ - 1, - 1 - ], - "type": "scale", - "input": "0", - "output": "physical" - } - ] - } - ], - "coordinateTransformations": [ - { - "scale": [ - 10, - 10 - ], - "type": "scale", - "input": "physical", - "output": "world" - } - ], - "name": "image_with_coordinateTransformations", - "type": "foo", - "metadata": { - "key": "value" - } - } - ] - }, - "_conformance": { - "schema": { - "id": "schemas/strict_image.schema" - } - } - } -} \ No newline at end of file diff --git a/tests/zarr/strict/valid/plate/strict_acquisitions.ome.zarr/zarr.json b/tests/zarr/strict/valid/plate/strict_acquisitions.ome.zarr/zarr.json deleted file mode 100644 index c9b5a501..00000000 --- a/tests/zarr/strict/valid/plate/strict_acquisitions.ome.zarr/zarr.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "zarr_format": 3, - "node_type": "group", - "attributes": { - "ome": { - "version": "0.6rc0", - "plate": { - "acquisitions": [ - { - "id": 0, - "name": "0", - "maximumfieldcount": 1 - } - ], - "columns": [ - { - "name": "A" - } - ], - "name": "test plate", - "rows": [ - { - "name": "1" - } - ], - "wells": [ - { - "path": "A/1", - "rowIndex": 0, - "columnIndex": 0 - } - ] - } - }, - "_conformance": { - "schema": { - "id": "schemas/strict_plate.schema" - }, - "description": "Tests for the strict plate JSON schema: " - } - } -} \ No newline at end of file diff --git a/tests/zarr/strict/valid/plate/strict_no_acquisitions.ome.zarr/zarr.json b/tests/zarr/strict/valid/plate/strict_no_acquisitions.ome.zarr/zarr.json deleted file mode 100644 index dc80db86..00000000 --- a/tests/zarr/strict/valid/plate/strict_no_acquisitions.ome.zarr/zarr.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "zarr_format": 3, - "node_type": "group", - "attributes": { - "ome": { - "version": "0.6rc0", - "plate": { - "columns": [ - { - "name": "A" - } - ], - "name": "test plate", - "rows": [ - { - "name": "1" - } - ], - "wells": [ - { - "path": "A/1", - "rowIndex": 0, - "columnIndex": 0 - } - ] - } - }, - "_conformance": { - "schema": { - "id": "schemas/strict_plate.schema" - }, - "description": "Tests for the strict plate JSON schema: " - } - } -} \ No newline at end of file diff --git a/tests/zarr/strict/valid/well/strict_acquisitions.ome.zarr/zarr.json b/tests/zarr/strict/valid/well/strict_acquisitions.ome.zarr/zarr.json deleted file mode 100644 index 457197f8..00000000 --- a/tests/zarr/strict/valid/well/strict_acquisitions.ome.zarr/zarr.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "zarr_format": 3, - "node_type": "group", - "attributes": { - "ome": { - "version": "0.6rc0", - "well": { - "images": [ - { - "acquisition": 0, - "path": "0" - } - ] - } - }, - "_conformance": { - "schema": { - "id": "schemas/strict_well.schema" - }, - "description": "Tests for the strict well JSON schema: " - } - } -} \ No newline at end of file diff --git a/tests/zarr/strict/valid/well/strict_no_acquisitions.ome.zarr/zarr.json b/tests/zarr/strict/valid/well/strict_no_acquisitions.ome.zarr/zarr.json deleted file mode 100644 index 3836d3a9..00000000 --- a/tests/zarr/strict/valid/well/strict_no_acquisitions.ome.zarr/zarr.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "zarr_format": 3, - "node_type": "group", - "attributes": { - "ome": { - "version": "0.6rc0", - "well": { - "images": [ - { - "path": "0" - } - ] - } - }, - "_conformance": { - "schema": { - "id": "schemas/strict_well.schema" - }, - "description": "Tests for the strict well JSON schema: " - } - } -} \ No newline at end of file