transformations Examples#

This document contains JSON examples for transformations metadata layouts.

scale_with_discrete#

 1{
 2  "coordinateSystems": [
 3    {
 4      "name": "in",
 5      "axes": [
 6        {"name": "k", "type": "channel", "discrete": true},
 7        {"name": "j", "type": "space", "discrete": false},
 8        {"name": "i", "type": "space", "discrete": false}
 9      ]
10    },
11    {
12      "name": "out",
13      "axes": [
14        {"name": "c", "type": "channel", "discrete": true},
15        {"name": "y", "type": "space", "discrete": false},
16        {"name": "x", "type": "space", "discrete": false}
17      ]
18    }
19  ],
20  "coordinateTransformations": [ 
21    {
22      "type": "scale",
23      "scale": [1, 3.12, 2],
24      "input": {"name": "in"},
25      "output": {"name": "out"}
26    }
27  ]
28}

rotation#

 1{
 2  "coordinateSystems" : [
 3    {
 4      "name" : "ji",
 5      "axes" : [{"name" : "j", "type": "space"}, {"name":"i", "type": "space"}]
 6    },
 7    {
 8      "name" : "yx",
 9      "axes" : [{"name" : "y", "type": "space"}, {"name":"x", "type": "space"}]
10    }
11  ],
12  "coordinateTransformations" : [
13    {
14      "type": "rotation",
15      "rotation": [[0, -1], [1, 0]],
16      "input" : {"name": "ji"},
17      "output" : {"name": "yx"}
18    }
19  ]
20}

affine2d2d_with_channel#

 1{
 2  "coordinateSystems" : [
 3    {
 4      "name": "cji",
 5      "axes": [
 6        {"name": "k", "discrete": true, "type": "space"},
 7        {"name": "j", "discrete": false, "type": "space"},
 8        {"name": "i", "discrete": false, "type": "space"}
 9      ]
10    },
11    {
12      "name": "cyx",
13      "axes": [
14        {"name": "c", "discrete": true, "type": "space"},
15        {"name": "y", "discrete": false, "type": "space"},
16        {"name": "x", "discrete": false, "type": "space"}
17      ]
18    }
19  ],
20  "coordinateTransformations" : [ 
21    {
22      "type": "affine",
23      "affine": [
24        [1, 0, 0, 0],
25        [0, 1, 2, 3],
26        [0, 4, 5, 6]
27      ],
28      "input": {"name": "cji"},
29      "output": {"name": "cyx"}
30    }
31  ]
32}

sequenceSubspace1#

 1{
 2  "coordinateSystems" : [
 3    {
 4      "name" : "in",
 5      "axes" : [ {"name" : "i", "type": "space"}, {"name" : "j", "type": "space"} ]
 6    },
 7    {
 8      "name" : "out",
 9      "axes" : [ {"name" : "x", "type": "space"}, {"name" : "y", "type": "space"} ]
10    }
11  ],
12  "coordinateTransformations" : [
13    {
14      "type" : "sequence",
15      "input" : {"name" : "in"},
16      "output" : {"name" : "out"},
17      "transformations" : [
18        {
19            "type" : "coordinates",
20            "path" : "/coordinates",
21            "inputAxes" : ["i"],
22            "outputAxes" : ["x"]
23        },
24        {
25            "type" : "scale",
26            "scale" : [2.0],
27            "inputAxes" : ["j"],
28            "outputAxes" : ["y"]
29        }
30      ]
31    }
32  ]
33}

byDimensionInvalid1#

 1{
 2  "coordinateSystems": [
 3    {
 4      "name": "in",
 5      "axes": [ {"name": "j", "type": "space"}, {"name": "i", "type": "space"} ]
 6    },
 7    {
 8      "name": "out",
 9      "axes": [ {"name": "y", "type": "space"}, {"name": "x", "type": "space"} ]
10    }
11  ],
12  "coordinateTransformations": [
13    {
14      "type": "byDimension",
15      "input": {"name": "in"},
16      "output": {"name": "out"},
17      "transformations": [
18        {
19          "transformation": {
20            "type": "translation",
21            "translation": [-1.0]
22          },
23          "inputAxes": [1],
24          "outputAxes": [2]
25        },
26        {
27          "transformation": {
28            "type": "scale",
29            "scale": [2.0]
30          },
31          "inputAxes": [0],
32          "outputAxes": [2]
33        }
34      ]
35    }
36  ]
37}

byDimensionXarray#

 1{
 2  "coordinateSystems": [
 3    {
 4      "name": "physical",
 5      "axes": [
 6        { "name": "x", "type": "space", "unit": "micrometer" },
 7        { "name": "y", "type": "space", "unit": "micrometer" }
 8      ]
 9    },
10    {
11      "name": "array",
12      "axes": [
13        { "name": "dim_0", "type": "space" },
14        { "name": "dim_1", "type": "space" }
15      ]
16    }
17  ],
18  "coordinateTransformations": [
19    {
20      "type": "byDimension",
21      "input": {"name": "array"},
22      "output": {"name": "physical"},
23      "transformations": [
24        {
25          "type": "coordinates",
26          "path": "xCoordinates",
27          "inputAxes": [ 0 ],
28          "outputAxes": [ 0 ]
29        },
30        {
31          "type": "coordinates",
32          "path": "yCoordinates",
33          "inputAxes": [ 1 ],
34          "outputAxes": [ 1 ]
35        }
36      ]
37    }
38  ]
39}

bijection_verbose#

1{
2  "type": "bijection",
3  "forward": { "type" : "coordinates", "path" : "forward_coordinates", "input" : {"name": "src"}, "output" : {"name": "tgt"} },
4  "inverse": { "type" : "coordinates", "path" : "inverse_coordinates", "input" : {"name": "tgt"}, "output" : {"name": "src"} },
5  "input": {"name": "src"},
6  "output": {"name": "tgt"}
7}

bijection#

 1{
 2  "coordinateSystems" : [
 3    {
 4      "name": "src",
 5      "axes": [{"name": "j", "type": "space"}, {"name": "i", "type": "space"}]
 6    },
 7    {
 8      "name": "tgt",
 9      "axes": [{"name": "y", "type": "space"}, {"name": "x", "type": "space"}]
10    }
11  ],
12  "coordinateTransformations" : [ 
13    {
14      "type": "bijection",
15      "forward": {
16        "type" : "coordinates",
17        "path" : "forward_coordinates"
18      },
19      "inverse": {
20        "type" : "coordinates",
21        "path" : "inverse_coordinates"
22      },
23      "input": {"name": "src"},
24      "output": {"name": "tgt"}
25    }
26  ]
27}

mapAxis1#

 1{
 2  "coordinateSystems": [
 3    {
 4      "name": "in",
 5      "axes": [ {"name": "j", "type": "space"}, {"name": "i", "type": "space"} ]
 6    },
 7    {
 8      "name": "out1",
 9      "axes": [ {"name": "y", "type": "space"}, {"name": "x", "type": "space"} ]
10    },
11    {
12      "name": "out2",
13      "axes": [ {"name": "y", "type": "space"}, {"name": "x", "type": "space"} ]
14    }
15  ],
16  "coordinateTransformations": [ 
17    { 
18      "name": "equivalent to identity",
19      "type": "mapAxis", 
20      "mapAxis": [0, 1],
21      "input": "in",
22      "output": "out1" 
23    },
24    { 
25      "name": "permutation",
26      "type": "mapAxis", 
27      "mapAxis": [1, 0],
28      "input": {"name": "in"},
29      "output": {"name": "out2"} 
30    }
31  ]
32}

affine2d3d#

 1{
 2  "coordinateSystems": [
 3    {
 4      "name": "ij",
 5      "axes": [{"name": "i", "type": "space"}, {"name": "j", "type": "space"}]
 6    },
 7    {
 8      "name": "zyx",
 9      "axes": [{"name": "z", "type": "space"}, {"name": "y", "type": "space"}, {"name": "x", "type": "space"}]
10    }
11  ],
12  "coordinateTransformations": [ 
13    {
14      "type": "affine",
15      "affine": [[1, 0, 0], [2, 3, 4], [5, 6, 7]],
16      "input": {"name": "ij"},
17      "output": {"name": "zyx"}
18    }
19  ]
20}

byDimensionInvalid2#

 1{
 2  "coordinateSystems": [
 3    {
 4      "name": "in",
 5      "axes": [ {"name": "j", "type": "space"}, {"name": "i", "type": "space"} ]
 6    },
 7    {
 8      "name": "out",
 9      "axes": [ {"name": "y", "type": "space"}, {"name": "x", "type": "space"} ]
10    }
11  ],
12  "coordinateTransformations": [
13    {
14      "type": "byDimension",
15      "input": {"name": "in"},
16      "output": {"name": "out"},
17      "transformations": [
18        {
19          "transformation": {
20
21            "type": "translation",
22            "translation": [-1.0]
23          },
24          "inputAxes": [1],
25          "outputAxes": [1]
26        },
27        {
28          "transformation": {
29            "type": "scale",
30            "scale": [2.0]
31          },
32          "inputAxes": [1],
33          "outputAxes": [1]
34        }
35      ]
36    }
37  ]
38}

projectAxis2#

 1{
 2  "coordinateSystems": [
 3    { "name": "in", "axes": [ {"name": "c"}, {"name": "i"}, {"name": "j"} ]},
 4    { "name": "out", "axes": [ {"name": "z"}, {"name": "y"}, {"name": "x"} ]}
 5  ],
 6  "coordinateTransformations": [ 
 7    { 
 8      "name": "up-project",
 9      "type": "projectAxis", 
10      "createdOutputs": [0],
11      "droppedInputs": [0],
12      "input": {"name": "in"},
13      "output": {"name": "out"} 
14    }
15  ]
16}

byDimension2#

 1{
 2  "coordinateSystems": [
 3    {
 4      "name": "in",
 5      "axes": [
 6        { "name": "l", "type": "space" },
 7        { "name": "j", "type": "space" },
 8        { "name": "k", "type": "space" },
 9        { "name": "i", "type": "space" }
10      ]
11    },
12    {
13      "name": "out",
14      "axes": [
15        { "name": "z", "type": "space" },
16        { "name": "y", "type": "space" },
17        { "name": "x", "type": "space" }
18      ]
19    }
20  ],
21  "coordinateTransformations": [
22    {
23      "type": "byDimension",
24      "input": {"name": "in"},
25      "output": {"name": "out"},
26      "transformations": [
27        {
28          "transformation": {
29            "type": "translation",
30            "translation": [ 0.5, 1.5 ]
31          },
32          "inputAxes": [ 3, 2 ],
33          "outputAxes": [ 1, 2 ]
34        },
35        {
36          "transformation": {
37            "type": "scale",
38            "scale": [ 2 ]
39          },
40          "inputAxes": [ 1 ],
41          "outputAxes": [ 0 ]
42        }
43      ]
44    }
45  ]
46}

affine2d2d#

 1{
 2  "coordinateSystems" : [
 3    {
 4      "name": "ji",
 5    "axes": [{"name": "j", "type": "space"}, {"name": "i", "type": "space"}]
 6    },
 7    {
 8      "name": "yx",
 9      "axes": [{"name": "y", "type": "space"}, {"name": "x", "type": "space"}]
10    }
11  ],
12  "coordinateTransformations" : [ 
13    {
14      "type": "affine",
15      "affine": [[1, 2, 3], [4, 5, 6]],
16      "input": {"name": "ji"},
17      "output": {"name": "yx"}
18    }
19  ]
20}

sequence#

 1{
 2  "coordinateSystems": [
 3    {
 4      "name": "in",
 5      "axes": [ {"name": "j", "type": "space"}, {"name": "i", "type": "space"} ]
 6    },
 7    {
 8      "name": "out",
 9      "axes": [ {"name": "y", "type": "space"}, {"name": "x", "type": "space"} ]
10    }
11  ],
12  "coordinateTransformations": [ 
13    {
14      "type": "sequence",
15      "input": {"name": "in"},
16      "output": {"name": "out"},
17      "transformations": [
18        {
19            "type": "translation",
20            "translation": [0.1, 0.9]
21        },
22        {
23            "type": "scale",
24            "scale": [2, 3]
25        }
26      ]
27    }
28  ]
29}

translation#

 1{
 2  "coordinateSystems": [
 3    {
 4      "name": "in",
 5      "axes": [{"name": "j", "type": "space"}, {"name": "i", "type": "space"}]
 6    },
 7    {
 8      "name": "out",
 9      "axes": [{"name": "y", "type": "space"}, {"name": "x", "type": "space"}]
10    }
11  ],
12  "coordinateTransformations" : [ 
13    {
14      "type": "translation",
15      "input": {"name": "in"},
16      "output": {"name": "out"},
17      "translation": [9, -1.42]
18    }
19  ]
20}

identity#

 1{
 2  "coordinateSystems": [
 3    {
 4      "name": "in",
 5      "axes": [ {"name": "j", "type": "space"}, {"name": "i", "type": "space"} ]
 6    },
 7    {
 8      "name": "out",
 9      "axes": [ {"name": "y", "type": "space"}, {"name": "x", "type": "space"} ]
10    }
11  ],
12  "coordinateTransformations": [ 
13    { "type": "identity", "input": {"name": "in"}, "output": {"name": "out"} }
14  ]
15}

byDimension1#

 1{
 2  "coordinateSystems": [
 3    {
 4      "name": "in",
 5      "axes": [ {"name": "j", "type": "space"}, {"name": "i", "type": "space"} ]
 6    },
 7    {
 8      "name": "out",
 9      "axes": [ {"name": "y", "type": "space"}, {"name": "x", "type": "space"} ]
10    }
11  ],
12  "coordinateTransformations": [
13    {
14      "type": "byDimension",
15      "input": {"name": "in"},
16      "output": {"name": "out"},
17      "transformations": [
18        {
19          "transformation": {
20            "type": "translation",
21            "translation": [-1.0]
22          },
23          "inputAxes": [1],
24          "outputAxes": [1]
25        },
26        {
27          "transformation": {
28            "type": "scale",
29            "scale": [2.0]
30          },
31          "inputAxes": [0],
32          "outputAxes": [0]
33        }
34      ]
35    }
36  ]
37}

scale#

 1{
 2  "coordinateSystems": [
 3    {
 4      "name": "in",
 5      "axes": [{"name": "j", "type": "space"}, {"name": "i", "type": "space"}]
 6    },
 7    {
 8      "name": "out",
 9      "axes": [{"name": "y", "type": "space"}, {"name": "x", "type": "space"}]
10    }
11  ],
12  "coordinateTransformations": [ 
13    {
14      "type": "scale",
15      "scale": [2, 3.12],
16      "input": {"name": "in"},
17      "output": {"name": "out"}
18    }
19  ]
20}

projectAxis#

 1{
 2  "coordinateSystems": [
 3    { "name": "in", "axes": [ {"name": "i"}, {"name": "j"} ]},
 4    { "name": "out", "axes": [ {"name": "c"}, {"name": "z"}, {"name": "y"}, {"name": "x"} ]}
 5  ],
 6  "coordinateTransformations": [ 
 7    { 
 8      "name": "up-project",
 9      "type": "projectAxis", 
10      "createdOutputs": [0, 1],
11      "input": {"name": "in"},
12      "output": {"name": "out"} 
13    }
14  ]
15}

xarrayLike#

 1{
 2  "coordinateSystems": [
 3    { "name": "in", "axes": [ {"name": "i", "type": "space"}, {"name": "j", "type": "space"} ]},
 4    { "name": "out", "axes": [ {"name": "x", "type": "space"}, {"name": "y", "type": "space"} ]}
 5  ],
 6  "coordinateTransformations": [ 
 7    {
 8      "type": "byDimension",
 9      "input": {"name": "in"},
10      "output": {"name": "out"},
11      "transformations": [
12        {
13          "transformation": {
14            "type": "coordinates",
15            "path": "/xCoordinates"
16          },
17          "inputAxes" : [0],
18          "outputAxes" : [0]
19        },
20        {
21          "transformation": {
22            "type": "coordinates",
23            "path": "/yCoordinates"
24          },
25          "inputAxes" : [1],
26          "outputAxes" : [1]
27        }
28      ]
29    }
30  ]
31}