Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coordinate transforms json-schema (request for feedback) #149

Draft
wants to merge 56 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
f0da62a
start of named space and transform metadata
bogovicj Feb 1, 2022
4331deb
fwd and inv coordinate transforms
bogovicj Feb 9, 2022
8051e71
Merge remote-tracking branch 'upstream/main' into coord-transforms
bogovicj Feb 9, 2022
180568b
more transform details
bogovicj Feb 9, 2022
4f48364
start page on details and recommendations
bogovicj Feb 9, 2022
98a40de
transformation progress
bogovicj May 5, 2022
dd71953
change fields to camelCase
bogovicj May 9, 2022
1b26a8e
add details for coordinate and displacement fields
bogovicj May 12, 2022
cd9c431
add details on dimension order
bogovicj May 13, 2022
e210027
clean up array indexing section
bogovicj May 13, 2022
d873541
add more details for scale, translation, displacement
bogovicj May 15, 2022
63ed4ce
merge and cleanup
bogovicj May 16, 2022
a459492
Merge remote-tracking branch 'upstream/main' into coord-transforms
bogovicj May 24, 2022
9058b4b
clarify input and output dimensionality for transforms
bogovicj Jun 1, 2022
38ac6ac
update to transformations
bogovicj Jun 3, 2022
3a2aae1
rotation transformation details
Jun 3, 2022
ed12192
minor rephrase intro to coordinateTransformations section
Jun 3, 2022
3ec8543
add details for bijection ct
bogovicj Jun 6, 2022
30cade5
big changes to transformations spec
bogovicj Jun 9, 2022
df470d7
Add "coordinateSystems" and "coordinateTransformations" fields for ex…
bogovicj Sep 6, 2022
99f3a4e
coordinate transformation updates:
bogovicj Sep 7, 2022
de73c68
update multiscales_example
bogovicj Sep 11, 2022
163c8f4
rename dimensionWise byDimension
bogovicj Sep 11, 2022
7b35c28
add more transformation examples
bogovicj Sep 11, 2022
7baeed7
byDimension examples, rm input/outputAxes fields
bogovicj Sep 11, 2022
162a9e9
reorder, simplify sections.
Sep 15, 2022
a90662d
clean up example formatting
Sep 15, 2022
32656e5
add array coordinate system example
Sep 16, 2022
0245ca9
rm duplicate editor names, typo fix
bogovicj Sep 23, 2022
a3ff0b5
fix sequence example json. add inverseOf to input/output field exception
Sep 23, 2022
0df402d
be clearer re: half-open interval
Sep 23, 2022
f05d480
move axes section into coordinateSystems section
bogovicj Oct 4, 2022
ed17ed5
typo fixes
bogovicj Oct 4, 2022
b9f89e1
Merge branch 'coord-transforms' of github.com:bogovicj/ngff into coor…
bogovicj Oct 4, 2022
cd01ab7
add two new coordinate transformation examples
bogovicj Oct 4, 2022
86672e6
Allow tests to access all schemas
ivirshup Oct 4, 2022
b34875d
Fix how schemas are matched to examples
ivirshup Oct 4, 2022
35ea3e3
Add initial coordinate system schemas
ivirshup Oct 4, 2022
3fcba53
Add array coordinate schema
ivirshup Oct 4, 2022
883ff1c
Add test for array coordinate system
ivirshup Oct 4, 2022
c2a18c4
Stop adding cases for .config files
ivirshup Oct 4, 2022
027b55b
describe where to store coordinateTransformations
bogovicj Oct 5, 2022
5bfe442
corrections for coordinates and displacements
bogovicj Oct 5, 2022
aab7469
add optional "longName" field for axes
bogovicj Oct 6, 2022
9764451
Merge branch 'coord-transforms' into coord-transforms-schemas
ivirshup Oct 9, 2022
098bfb8
Add longName property to axes schema
ivirshup Oct 9, 2022
f04ebef
Add mapAxis and mapIndex schemas
ivirshup Oct 9, 2022
ead1f7b
Add affine transfrom, use reference for path_w_url
ivirshup Oct 9, 2022
281df32
Move rotation example to example directory
ivirshup Oct 9, 2022
87d78e8
Add schema for rotation
ivirshup Oct 9, 2022
033d4bb
Move inverseOf example to examples directory
ivirshup Oct 9, 2022
f78e441
Added schema for inverseOf
ivirshup Oct 9, 2022
55e35bd
Added byDimension transformation
ivirshup Oct 9, 2022
0833395
Sequence schemas
ivirshup Oct 9, 2022
85808cf
Merge remote-tracking branch 'upstream/main' into coord-transforms
bogovicj Oct 12, 2022
9406ce1
Merge branch 'coord-transforms' into coord-transforms-schemas
ivirshup Oct 12, 2022
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
3 changes: 3 additions & 0 deletions latest/examples/coordSystems/.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"schema": "schemas/coordinate_transforms.schema"
}
10 changes: 10 additions & 0 deletions latest/examples/coordSystems/arrayCoordSys.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"arrayCoordinateSystem" : {
"name" : "myDataArray",
"axes" : [
{"name": "i", "type": "array"},
{"name": "j", "type": "array"},
{"name": "k", "type": "array"}
]
}
}
42 changes: 24 additions & 18 deletions latest/examples/multiscales_strict/multiscales_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,50 @@
{
"version": "0.5-dev",
"name": "example",
"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"}
"coordinateSystems" : [
{
"name" : "example",
"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": [{
// the voxel size for the first scale level (0.5 micrometer)
// the voxel size for the first scale level (0.5 micrometer), time unit (0.1 milliseconds)
"type": "scale",
"scale": [1.0, 1.0, 0.5, 0.5, 0.5]
"scale": [0.1, 1.0, 0.5, 0.5, 0.5],
"input" : "/0",
"output" : "example"
}]
},
{
"path": "1",
"coordinateTransformations": [{
// the voxel size for the second scale level (downscaled by a factor of 2 -> 1 micrometer)
// the voxel size for the second scale level (downscaled by a factor of 2 -> 1 micrometer), time unit (0.1 milliseconds)
"type": "scale",
"scale": [1.0, 1.0, 1.0, 1.0, 1.0]
"scale": [0.1, 1.0, 1.0, 1.0, 1.0],
"input" : "/1`",
"output" : "example"
}]
},
{
"path": "2",
"coordinateTransformations": [{
// the voxel size for the third scale level (downscaled by a factor of 4 -> 2 micrometer)
// the voxel size for the third scale level (downscaled by a factor of 4 -> 2 micrometer), time unit (0.1 milliseconds)
"type": "scale",
"scale": [1.0, 1.0, 2.0, 2.0, 2.0]
"scale": [0.1, 1.0, 2.0, 2.0, 2.0],
"input" : "/2",
"output" : "example"
}]
}
],
"coordinateTransformations": [{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the top-level multiscales coordinateTransformations no-longer valid? If it is, then this is a useful example. If not then the spec wording needs to be changed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will still be valid - I'll edit this example showing how.

// the time unit (0.1 milliseconds), which is the same for each scale level
"type": "scale",
"scale": [0.1, 1.0, 1.0, 1.0, 1.0]
}],
"type": "gaussian",
"metadata": {
"description": "the fields in metadata depend on the downscaling implementation. Here, the parameters passed to the skimage function are given",
Expand All @@ -51,4 +57,4 @@
}
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"multiscales": [
{
"version": "0.5-dev",
"name": "example",
"coordinateSystems" : [
{
"name" : "exampleCoordinateSystem",
"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"
// the transformation of other arrays are defined relative to this, the highest resolution, array
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spec still says:

"Each dictionary in "datasets" MUST contain the field "coordinateTransformations", which contains a list of transformations that map the data coordinates to the physical coordinates (as specified by "axes") for this resolution level.
The transformations are defined according to [[#trafo-md]]. The transformation MUST only be of type translation or scale.
They MUST contain exactly one scale transformation that specifies the pixel size in physical units or time duration. If scaling information is not available or applicable for one of the axes, the value MUST express the scaling factor between the current resolution and the first resolution for the given axis, defaulting to 1.0 if there is no downsampling along the axis."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bogovicj, assuming I should go with the spec over the example here?

Out of interest, why does the pixel -> physical need to be replicated here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the spec just needs updating or clarifying at that point. Maybe now it's

"Each dictionary in "datasets" except the first MUST contain the field "coordinateTransformations"...

},
{
"path": "1",
"coordinateTransformations": [{
// the second scale level (downscaled by a factor of 2 relative to "0" in zyx)
"type": "scale",
"scale": [1, 1, 2, 2, 2],
"input" : "/1`",
"output" : "/0"
}]
},
{
"path": "2",
"coordinateTransformations": [{
// the third scale level (downscaled by a factor of 4 relative to "0" in zyx)
"type": "scale",
"scale": [1, 1, 4, 4, 4],
"input" : "/2",
"output" : "/0"
}]
}
],
"coordinateTransformations": [{
// the time unit (0.1 milliseconds), the voxel size for all spatial axes of "0" (0.5 micrometers)
"type": "scale",
"scale": [0.1, 1.0, 0.5, 0.5, 0.5],
"input" : "/0",
"output" : "xampleCoordinateSystem"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exampleCoordinateSystem ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}],
"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}
}
}
]
}
64 changes: 64 additions & 0 deletions latest/examples/subspace/subspaceMultidim.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"coordinateSystems" : [
{ "name " : "in", "axes" : [ {"name" : "0", "name" : "1", "name": "2", "name": "3", "name": "4" }] },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The axes list has a single dict with multiple "name" keys? Is is supposed to be [{"name" : "0"}, {"name" : "1"}..] ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ "name " : "in", "axes" : [ {"name" : "0", "name" : "1", "name": "2", "name": "3", "name": "4" }] },
{ "name ": "in", "axes": [{"name" : "0"}, {"name" : "1"}, {"name": "2"}, {"name": "3"}, {"name": "4"}] },

@bogovicj, should changes to the examples happen here or in your PR?

I haven't modified these from your branch, but also could add tests for the subspace directory.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, I'll fix

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{ "name " : "out", "axes" : [ {"name" : "x", "name" : "y", "name" : "z" }] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, I'll fix

],
"coordinateTransformations" : [
{
"type" : "sequence",
"name" : "5D-to-3D",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this combination of mapIndex and scale really go from 5D data to 3D? And same for 5D-to-3D-not-contiguous examples below?

"input" : "in",
"output" : "out",
"transformations" : [
{
"type": "mapIndex",
"inputAxes" : ["0", "1"],
"outputAxes" : ["x", "y"]
},
{
"type": "scale",
"scale" : [2],
"inputAxes" : ["3"],
"outputAxes" : ["z"]
}
]
},
{
"type" : "sequence",
"name" : "5D-to-3D-not-contiguous",
"input" : "in",
"output" : "out",
"transformations" : [
{
"type": "mapIndex",
"inputAxes" : ["0", "2"],
"outputAxes" : ["x", "z"]
},
{
"type": "scale",
"scale" : [2],
"inputAxes" : ["1"],
"outputAxes" : ["y"]
}
]
},
{
"type" : "sequence",
"name" : "5D-to-3D-not-contiguous",
"input" : "in",
"output" : "out",
"transformations" : [
{
"type": "mapAxes",
"map" : {"0":"x", "2":"z"}
},
{
"type": "scale",
"scale" : [2],
"inputAxes" : ["1"],
"outputAxes" : ["y"]
}
]
}
]
}
26 changes: 26 additions & 0 deletions latest/examples/subspace/subspacePermute.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"coordinateSystems" : [
{ "name " : "in", "axes" : [ {"name" : "i", "name" : "j" }] },
{ "name " : "out", "axes" : [ {"name" : "x", "name" : "y" }] }
],
"coordinateTransformations" : [
{
"type" : "sequence",
"input" : "in",
"output" : "out",
"transformations" : [
{
"type": "identity",
"inputAxes" : ["j"],
"outputAxes" : ["x"]
},
{
"type": "scale",
"scale" : [2],
"inputAxes" : ["i"],
"outputAxes" : ["y"]
}
]
}
]
}
3 changes: 3 additions & 0 deletions latest/examples/transformations/.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"schema": "schemas/coordinate_transforms.schema"
}
14 changes: 14 additions & 0 deletions latest/examples/transformations/affine2d2d.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"coordinateSystems" : [
{ "name": "ij", "axes": [{"name": "i"}, {"name": "j"}] },
{ "name": "xy", "axes": [{"name": "x"}, {"name": "y"}] }
],
"coordinateTransformations" : [
{
"type": "affine",
"affine": [1, 2, 3, 4, 5, 6],
"input": "ij",
"output": "xy"
}
]
}
14 changes: 14 additions & 0 deletions latest/examples/transformations/affine2d3d.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"coordinateSystems": [
{ "name": "ij", "axes": [{"name": "i"}, {"name": "j"}] },
{ "name": "xyz", "axes": [{"name": "x"}, {"name": "y"}, {"name": "z"}] }
],
"coordinateTransformations": [
{
"type": "affine",
"affine": [1, 2, 3, 4, 5, 6, 7, 8, 9],
"input": "ij",
"output": "xyz"
}
]
}
17 changes: 17 additions & 0 deletions latest/examples/transformations/byDimension1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"coordinateSystems": [
{ "name": "in", "axes": [ {"name": "i"}, {"name": "j"} ] },
{ "name": "out", "axes": [ {"name": "x"}, {"name": "y"} ] }
],
"coordinateTransformations": [
{
"type": "byDimension",
"input": "in",
"output": "out",
"transformations": [
{ "type": "translation", "translation": [-1.0], "input": ["i"], "output": ["x"]},
{ "type": "scale", "scale": [2.0], "input": ["j"], "output": ["y"]}
]
}
]
}
17 changes: 17 additions & 0 deletions latest/examples/transformations/byDimension2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"coordinateSystems": [
{ "name": "in", "axes": [ {"name": "i"}, {"name": "j"}, {"name": "k"}, {"name": "l"}] },
{ "name": "out", "axes": [ {"name": "x"}, {"name": "y"}, {"name": "z"} ] }
],
"coordinateTransformations": [
{
"type": "byDimension",
"input": "in",
"output": "out",
"transformations" : [
{ "type": "translation", "translation": [1, 3], "input": ["i", "k" ], "output": ["y", "x"]},
{ "type": "scale", "scale": [2.0], "input": ["j"], "output": ["z"]}
]
}
]
}
17 changes: 17 additions & 0 deletions latest/examples/transformations/byDimensionInvalid1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"coordinateSystems": [
{ "name": "in", "axes": [ {"name": "i"}, {"name": "j"} ] },
{ "name": "out", "axes": [ {"name": "x"}, {"name": "y"} ] }
],
"coordinateTransformations": [
{
"type": "byDimension",
"input": "in",
"output": "out",
"transformations": [
{ "type": "translation", "translation": [-1.0], "input": ["i"], "output": ["z"]},
{ "type": "scale", "scale": [2.0], "input": ["0"], "output": ["y"]}
]
}
]
}
17 changes: 17 additions & 0 deletions latest/examples/transformations/byDimensionInvalid2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"coordinateSystems": [
{ "name": "in", "axes": [ {"name": "i"}, {"name": "j"} ] },
{ "name": "out", "axes": [ {"name": "x"}, {"name": "y"} ] }
],
"coordinateTransformations": [
{
"type": "byDimension",
"input": "in",
"output": "out",
"transformations": [
{ "type": "translation", "translation": [-1.0], "input": ["i"], "output": ["x"]},
{ "type": "scale", "scale": [2.0], "input": ["i"], "output": ["x"]}
]
}
]
}
14 changes: 14 additions & 0 deletions latest/examples/transformations/coordinates1d.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"coordinateSystems": [
{ "name": "i", "axes": [{"name": "i"}] },
{ "name": "x", "axes": [{"name": "x"}] }
],
"coordinateTransformations": [{
"name": "a coordinate field transform",
"type": "coordinates",
"path": "i2xCoordinates",
"input": "i",
"output": "x",
"interpolation": "nearest"
}]
}
14 changes: 14 additions & 0 deletions latest/examples/transformations/displacement1d.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"coordinateSystems": [
{ "name": "i", "axes": [{"name": "i"}] },
{ "name": "x", "axes": [{"name": "x"}] }
],
"coordinateTransformations": [{
"name": "a displacement field transform",
"type": "displacements",
"path": "i2xCoordinates",
"input": "i",
"output": "x",
"interpolation": "nearest"
}]
}
9 changes: 9 additions & 0 deletions latest/examples/transformations/identity.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"coordinateSystems": [
{ "name": "in", "axes": [ {"name": "i"}, {"name": "j"} ]},
{ "name": "out", "axes": [ {"name": "x"}, {"name": "y"} ]}
],
"coordinateTransformations": [
{ "type": "identity", "input": "in", "output": "out" }
]
}
Loading