Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ repo in [PR #5](https://github.com/clbarnes/oztest/pull/5). The script used for
from the `ngff-spec` repo at commit [5c76733](https://github.com/ome/ngff-spec/commit/5c76733fe3a1f97a3957909c879b15d57689f74e).
The script used for this import is under `scripts/import_v06_cases.py`.

## Custom test cases

If you extend your implementation to include metadata not in the OME-Zarr spec, you can use oztest too.

Structure your test cases in the same directory hierarchy
and use the `--custom-cases` argument to have them included in test discovery.

## Versioning

This project is currently in alpha (`0.x` series).
Expand Down
67 changes: 35 additions & 32 deletions cases/transform_coordinates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,38 @@ They do NOT test implementations' capability to transform images on the basis of
Each test case is an OME-Zarr hierarchy with a Scene in the root node.
This Scene contains a graph of coordinate systems joined by coordinate transformations.

At the root of each OME-Zarr hierarchy is a `conformance.toml` file, which lays out:

```toml
description = "The first case of my comprehensive and totally correct test suite."

# result should be within 0.000_001 of expected value
absolute_tolerance = 1e-06

# result should be within 0.1% of expected value
relative_tolerance = 0.001

[source]
name = "inputSystem" # name of the input coordinate system
coordinates = [
[ -1, -1, -1 ], # first 3D input coordinate
[ 0, 0, 0 ], # second 3D input coordinate
]

[target]
name = "outputSystem" # name of the output coordinate system
coordinates = [
[ 18, 57, 16 ], # first 3D expected output coordinate
[ 20, 60, 120 ], # second 3D expected output coordinate
]
At the root of each OME-Zarr hierarchy is an `oztest.json` file, which lays out:

```jsonc
{
"description": "The first case of my comprehensive and totally correct test suite.",
"transform_coordinates": {
"tolerance": { // optional, defaults as shown
"relative": 0.00001, // optional, default as shown
"absolute": 0.00000001 // optional, default as shown
},
"source": {
// input coordinate system name
"name": "mySourceCoordinateSystem",
"coordinates": [
// first input coordinate
[-1, -1, -1],
// second input coordinate
[0, 0, 0]
]
},
"target": {
// output coordinate system name
"name": "myTargetCoordinateSystem",
"coordinates": [
// expected result of transforming first input coordinate
[ 18, 57, 16 ],
// expected result of transforming second input coordinate
[ 20, 60, 120 ]
]
}
}
}
```

Users of the conformance tests should
Expand All @@ -41,7 +49,8 @@ Users of the conformance tests should
3. construct the coordinate system graph
4. find a path through the graph from the input to the output coordinate system
5. apply the resulting coordinate transform sequence to the input coordinates
6. check that the resulting coordinates equal the given output coordinates, to within the given tolerances
6. check that the resulting coordinates are close to the given output coordinates, using the `numpy.allclose` algorithm
`|a - b| <= (absolute + relative * |b|)`

raising an error if any of these steps are not possible.

Expand Down Expand Up @@ -79,7 +88,6 @@ The dingus MUST then
5. exit with status code 0

If any of the above steps are not supported by the implementation, the dingus MUST exit with a status code other than 0.
In this case, it MAY print to STDOUT a JSON-serialised [Error](#object-response) object.

For the example above, a passing test would exit with status code 0 after printing

Expand All @@ -93,9 +101,4 @@ For the example above, a passing test would exit with status code 0 after printi
| ----- | --------- | ---- | ----------- |
| coordinates | MUST | array of array of number | The resulting coordinates from transforming the input. |
| message | MAY | string | Free-text details. |

### Object: Error

| field | necessity | type | description |
| ----- | --------- | ---- | ----------- |
| message | MAY | string | Free-text description of error. |
| xfail | MAY | boolean, default `false` | Whether the dingus expected to fail this test. |
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"description": "Identity transformation.",
"transform_coordinates": {
"source": {
"coordinates": [
[
1,
2
]
],
"name": "input"
},
"target": {
"coordinates": [
[
1,
2
]
],
"name": "output"
},
"tolerance": {
"absolute": 1e-6,
"relative": 0.001
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"attributes": {
"ome": {
"scene": {
"coordinateSystems": [
{
"axes": [
{
"name": "y",
"type": "space"
},
{
"name": "x",
"type": "space"
}
],
"name": "input"
},
{
"axes": [
{
"name": "y",
"type": "space"
},
{
"name": "x",
"type": "space"
}
],
"name": "output"
}
],
"coordinateTransformations": [
{
"input": {
"name": "input"
},
"name": "inputToOutput",
"output": {
"name": "output"
},
"type": "identity"
}
]
},
"version": "0.6"
}
},
"node_type": "group",
"zarr_format": 3
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"description": "Identity transformation. (inverse)",
"transform_coordinates": {
"source": {
"coordinates": [
[
1,
2
]
],
"name": "output"
},
"target": {
"coordinates": [
[
1,
2
]
],
"name": "input"
},
"tolerance": {
"absolute": 1e-6,
"relative": 0.001
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"attributes": {
"ome": {
"scene": {
"coordinateSystems": [
{
"axes": [
{
"name": "y",
"type": "space"
},
{
"name": "x",
"type": "space"
}
],
"name": "input"
},
{
"axes": [
{
"name": "y",
"type": "space"
},
{
"name": "x",
"type": "space"
}
],
"name": "output"
}
],
"coordinateTransformations": [
{
"input": {
"name": "input"
},
"name": "inputToOutput",
"output": {
"name": "output"
},
"type": "identity"
}
]
},
"version": "0.6"
}
},
"node_type": "group",
"zarr_format": 3
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"description": "Simple scale.",
"transform_coordinates": {
"source": {
"coordinates": [
[
1,
2
]
],
"name": "input"
},
"target": {
"coordinates": [
[
10,
40
]
],
"name": "output"
},
"tolerance": {
"absolute": 1e-6,
"relative": 0.001
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"attributes": {
"ome": {
"scene": {
"coordinateSystems": [
{
"axes": [
{
"name": "y",
"type": "space"
},
{
"name": "x",
"type": "space"
}
],
"name": "input"
},
{
"axes": [
{
"name": "y",
"type": "space"
},
{
"name": "x",
"type": "space"
}
],
"name": "output"
}
],
"coordinateTransformations": [
{
"input": {
"name": "input"
},
"name": "inputToOutput",
"output": {
"name": "output"
},
"scale": [
10,
20
],
"type": "scale"
}
]
},
"version": "0.6"
}
},
"node_type": "group",
"zarr_format": 3
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"description": "Simple scale. (inverse)",
"transform_coordinates": {
"source": {
"coordinates": [
[
10,
40
]
],
"name": "output"
},
"target": {
"coordinates": [
[
1,
2
]
],
"name": "input"
},
"tolerance": {
"absolute": 1e-6,
"relative": 0.001
}
}
}
Loading
Loading