|
3 | 3 | NGFF is an initiative by the bioimaging community to develop imaging format specifications to |
4 | 4 | address issues of scalability and interoperability. |
5 | 5 |
|
6 | | -This repository contains the central [specification text](./ngff_spec/specification.md), |
7 | | -a comprehensive list of [metadata examples](./ngff_spec/examples) |
8 | | -as well as [json schemas](./ngff_spec/schemas) to validate written ome-zarr image data. |
| 6 | +This repository contains the central [specification text](./specification.md), |
| 7 | +a comprehensive list of [metadata examples](./examples) |
| 8 | +as well as [json schemas](./schemas) to validate written ome-zarr image data. |
9 | 9 |
|
10 | | -The built including contribution hints can be found **[here]([url](https://ngff-spec.readthedocs.io/en/latest/specification.html))**. |
| 10 | +The built documentation including contribution hints can be found **[here](https://ngff-spec.readthedocs.io/en/latest/)**. |
| 11 | + |
| 12 | +## Conformance tests |
| 13 | + |
| 14 | +Conformance can be tested at several levels. |
| 15 | + |
| 16 | +1. Validating that individual fields of a zarr attributes object are valid. |
| 17 | +2. Validating a single zarr attributes object (i.e. containing OME-Zarr metadata) |
| 18 | + |
| 19 | + - Validates that correct data can be represented, and that internally inconsistent data can be caught |
| 20 | + - Cannot validate references to other objects in the zarr hierarchy |
| 21 | + - Cannot validate conformance to other zarr metadata e.g. array data type, dimensionality |
| 22 | + |
| 23 | +3. Validating a metadata-only zarr hierarchy |
| 24 | + |
| 25 | + - Can validate references to other objects and other zarr metadata |
| 26 | + - Cannot validate values e.g. the invertibility of an affine matrix defined as a zarr array |
| 27 | + |
| 28 | +4. Validating a zarr hierarchy with data |
| 29 | + |
| 30 | +This repository contains |
| 31 | + |
| 32 | +- JSON schemas which handle level 1 |
| 33 | +- a set of test zarr attributes JSON for level 2 ([`./tests/attributes`](./tests/attributes/)) |
| 34 | +- a set of metadata-only zarr hierarchies for level 3 ([`./tests/zarr`](./tests/zarr/)) |
| 35 | + |
| 36 | +as well as a tool for feeding these test cases into an external validator. |
| 37 | + |
| 38 | +### Testing tool |
| 39 | + |
| 40 | +See [`ome_zarr_conformance.py`](./conformance/ome_zarr_conformance.py). |
| 41 | + |
| 42 | +Run it in either `attributes` or `zarr` mode, optionally with filters for test names or types. |
| 43 | + |
| 44 | +Wrap your own OME-Zarr implementation in a |
| 45 | +["dingus"](https://talk.commonmark.org/t/origin-of-the-usage-for-dingus/1226) CLI, |
| 46 | +which takes as its last argument the path to either |
| 47 | + |
| 48 | +- attributes mode: a JSON file representing zarr attributes (i.e. containing OME-Zarr metadata) |
| 49 | +- zarr mode: a zarr hierarchy root on the file system (i.e. a directory containing `zarr.json`) |
| 50 | + |
| 51 | +The dingus should print to STDOUT a JSON object with the keys: |
| 52 | + |
| 53 | +- `"valid"`: boolean, whether this is valid |
| 54 | +- optionally `"message"`: string, free text describing the success/ failure |
| 55 | + |
| 56 | +Call the tool like |
| 57 | + |
| 58 | +```sh |
| 59 | +python3 ./conformance/ome_zarr_conformance.py attributes -- path/to/my/dingus -dingusArg +argValue 10 |
| 60 | +``` |
| 61 | + |
| 62 | +Each call to the dingus will then look like |
| 63 | + |
| 64 | +```sh |
| 65 | +>>> path/to/my/dingus -dingusArg +argValue 10 /home/you/ngff-spec/tests/attributes/spec/valid/custom_type_axes.json |
| 66 | + |
| 67 | +{"valid": true} |
| 68 | +``` |
| 69 | + |
| 70 | +`ome_zarr_conformance.py` will parse the JSON output and format the results of all requested tests in a tab-separated table. |
| 71 | + |
| 72 | +Full usage information is available with `./conformance/ome_zarr_conformance.py --help`. |
| 73 | + |
| 74 | +### JSON Schema tests |
| 75 | + |
| 76 | +You can use the conformance testing tool to test JSON Schema-based validation with |
| 77 | + |
| 78 | +```sh |
| 79 | +>>> ./conformance/ome_zarr_conformance.py attributes -- uv run ./conformance/jsonschema_dingus.py attributes |
| 80 | +``` |
| 81 | + |
| 82 | +Some failures are expected as JSON Schema can only handle level 1 validation. |
0 commit comments