Skip to content

Commit fbc471c

Browse files
committed
spec: broaden scope of mapAxis
1 parent a40b25c commit fbc471c

4 files changed

Lines changed: 156 additions & 15 deletions

File tree

examples/transformations/mapAxis2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
{
1616
"name": "projection up",
1717
"type": "mapAxis",
18-
"mapAxis": [1, 1, 0],
18+
"mapAxis": [null, 0, 1],
1919
"input": {"name": "in"},
2020
"output": {"name": "out_up"}
2121
}

index.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -741,18 +741,20 @@ y = j
741741
##### mapAxis
742742
(mapAxis-md)=
743743

744-
`mapAxis` transformations describe axis permutations as a transpose vector of integers.
744+
`mapAxis` transformations describe axis permutations, adding or dropping of axes as a vector of integers or nulls.
745745
Transformations MUST include a `mapAxis` field
746-
whose value is an array of integers that specifies the new ordering in terms of indices of the old order.
747-
The length of the array MUST equal the number of dimensions in both the input and output coordinate systems.
746+
whose value is an array of unique integers or nulls that specifies the new ordering in terms of indices of the old order.
748747
Each integer in the array MUST be a valid zero-based index into the input coordinate system's axes
749748
(i.e., between 0 and N-1 for an N-dimensional input).
750-
Each index MUST appear exactly once in the array.
751749
The value at position `i` in the array indicates which input axis becomes the `i`-th output axis.
752-
`mapAxis` transforms are invertible.
750+
`mapAxis` transforms are invertible if the array contains no nulls
751+
and its length corresponds to the number of dimensions in both the input and output coordinate systems.
752+
753+
If the value `null` is used in a `mapAxis` transformation,
754+
this corresponds to adding the value zero in the coordinate vector at the position of the null.
753755

754756
**mapAxis**
755-
: The axis permutation stored as a JSON array of integers.
757+
: The axis permutation stored as a JSON array of integers or nulls.
756758

757759

758760
:::{dropdown} Example 1
@@ -792,9 +794,9 @@ x = b
792794
and the `projection_up` transformation defines the function:
793795

794796
```
795-
x = a
796-
y = b
797-
z = b
797+
x = b
798+
y = a
799+
z = 0
798800
```
799801
:::
800802

schemas/coordinate_transformations.schema

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,20 @@
119119
"mapAxis": {
120120
"type": "array",
121121
"items": {
122-
"type": "integer",
123-
"minimum": 0,
124-
"maximum": 4
122+
"anyOf": [
123+
{
124+
"type": "integer",
125+
"minimum": 0,
126+
"maximum": 4
127+
},
128+
{
129+
"type": "null"
130+
}
131+
]
125132
},
126-
"minItems": 2,
127133
"maxItems": 5,
128134
"uniqueItems": true,
129-
"description": "An array of integers representing the new axis order as zero-based indices of the input axes."
135+
"description": "An array of integers or nulls representing the new axis order as zero-based indices of the input axes."
130136
}
131137
},
132138
"required": [
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
{
2+
"ome": {
3+
"version": "0.6.dev4",
4+
"multiscales": [
5+
{
6+
"name": "multiscales",
7+
"coordinateSystems": [
8+
{
9+
"name": "world",
10+
"axes": [
11+
{
12+
"type": "space",
13+
"name": "z",
14+
"unit": "micrometer",
15+
"discrete": false
16+
},
17+
{
18+
"type": "space",
19+
"name": "y",
20+
"unit": "micrometer",
21+
"discrete": false
22+
},
23+
{
24+
"type": "space",
25+
"name": "x",
26+
"unit": "micrometer",
27+
"discrete": false
28+
}
29+
]
30+
},
31+
{
32+
"name": "physical",
33+
"axes": [
34+
{
35+
"type": "space",
36+
"name": "y",
37+
"unit": "micrometer",
38+
"discrete": false
39+
},
40+
{
41+
"type": "space",
42+
"name": "x",
43+
"unit": "micrometer",
44+
"discrete": false
45+
}
46+
]
47+
}
48+
],
49+
"datasets": [
50+
{
51+
"path": "s0",
52+
"coordinateTransformations": [
53+
{
54+
"type": "sequence",
55+
"output": {"name": "physical"},
56+
"input": {"path": "s0"},
57+
"name": "scale0_to_physical",
58+
"transformations": [
59+
{
60+
"type": "scale",
61+
"scale": [1, 1]
62+
},
63+
{
64+
"type": "translation",
65+
"translation": [0, 0]
66+
}
67+
]
68+
}
69+
]
70+
},
71+
{
72+
"path": "s1",
73+
"coordinateTransformations": [
74+
{
75+
"type": "sequence",
76+
"output": {"name": "physical"},
77+
"input": {"path": "s1"},
78+
"name": "scale1_to_physical",
79+
"transformations": [
80+
{
81+
"type": "scale",
82+
"scale": [2, 2]
83+
},
84+
{
85+
"type": "translation",
86+
"translation": [0.7071, 0.7071]
87+
}
88+
]
89+
}
90+
]
91+
},
92+
{
93+
"path": "s2",
94+
"coordinateTransformations": [
95+
{
96+
"type": "sequence",
97+
"output": {"name": "physical"},
98+
"input": {"path": "s2"},
99+
"name": "scale2_to_physical",
100+
"transformations": [
101+
{
102+
"type": "scale",
103+
"scale": [4, 4]
104+
},
105+
{
106+
"type": "translation",
107+
"translation": [2.1213, 2.1213]
108+
}
109+
]
110+
}
111+
]
112+
}
113+
],
114+
"coordinateTransformations": [
115+
{
116+
"type": "mapAxis",
117+
"name": "physical-to-world",
118+
"input": {"name": "physical"},
119+
"output": {"name": "world"},
120+
"mapAxis": [null, 0, 1]
121+
}
122+
]
123+
}
124+
]
125+
},
126+
"_conformance": {
127+
"schema": {
128+
"id": "schemas/image.schema"
129+
},
130+
"description": "Tests for a JSON document with a mapAxis transformation",
131+
"valid": true
132+
}
133+
}

0 commit comments

Comments
 (0)