transformations Examples#

This document contains JSON examples for transformations metadata layouts.

byDimensionInvalid2#

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

byDimension1#

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

rotation#

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

coordinates1d#

 1{
 2  "coordinateSystems": [
 3    { "name": "input", "axes": [{"name": "i"}] },
 4    { "name": "output", "axes": [{"name": "x"}] }
 5  ],
 6  "coordinateTransformations": [{
 7    "name": "a coordinate field transform",
 8    "type": "coordinates",
 9    "path": "i2xCoordinates",
10    "input": "input",
11    "output": "output",
12    "interpolation": "nearest"
13  }]
14}

bijection_verbose#

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

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": "array" },
14        { "name": "dim_1", "type": "array" }
15      ]
16    }
17  ],
18  "coordinateTransformations": [
19    {
20      "type": "byDimension",
21      "input": "array",
22      "output": "physical",
23      "transformations": [
24        {
25          "type": "coordinates",
26          "path": "xCoordinates",
27          "input_axes": [ "dim_0" ],
28          "output_axes": [ "x" ]
29        },
30        {
31          "type": "coordinates",
32          "path": "yCoordinates",
33          "input_axes": [ "dim_1" ],
34          "output_axes": [ "y" ]
35        }
36      ]
37    }
38  ]
39}

affine2d2d#

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

scale_with_discrete#

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

bijection#

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

byDimensionInvalid1#

 1{
 2  "coordinateSystems": [
 3    { "name": "in", "axes": [ {"name": "j"}, {"name": "i"} ] },
 4    { "name": "out", "axes": [ {"name": "y"}, {"name": "x"} ] }
 5  ],
 6  "coordinateTransformations": [
 7    {
 8      "type": "byDimension",
 9      "input": "in",
10      "output": "out",
11      "transformations": [
12        {
13          "type": "translation",
14          "translation": [-1.0],
15          "input_axes": ["i"],
16          "output_axes": ["z"]
17        },
18        {
19          "type": "scale",
20          "scale": [2.0],
21          "input_axes": ["0"],
22          "output_axes": ["y"]
23        }
24      ]
25    }
26  ]
27}

affine2d3d#

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

sequence#

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

byDimension2#

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

scale#

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

xarrayLike#

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

displacement1d#

 1{
 2  "coordinateSystems": [
 3    { "name": "input", "axes": [{"name": "i"}] },
 4    { "name": "output", "axes": [{"name": "x"}] }
 5  ],
 6  "coordinateTransformations": [{
 7    "name": "a displacement field transform",
 8    "type": "displacements",
 9    "path": "i2xCoordinates",
10    "input": "input",
11    "output": "output",
12    "interpolation": "nearest"
13  }]
14}

mapAxis1#

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

affine2d2d_with_channel#

 1{
 2  "coordinateSystems" : [
 3    {
 4      "name": "cji",
 5      "axes": [
 6        {"name": "k", "discrete": true},
 7        {"name": "j", "discrete": false},
 8        {"name": "i", "discrete": false}
 9      ]
10    },
11    {
12      "name": "cyx",
13      "axes": [
14        {"name": "c", "discrete": true},
15        {"name": "y", "discrete": false},
16        {"name": "x", "discrete": false}
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": "cji",
29      "output": "cyx"
30    }
31  ]
32}

identity#

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

mapAxis2#

 1{
 2  "coordinateSystems": [
 3    { "name": "in", "axes": [ {"name": "a"}, {"name": "b"}]},
 4    { "name": "out_down", "axes": [ {"name": "x"}]},
 5    { "name": "out_up", "axes": [ {"name": "z"}, {"name": "y"}, {"name": "x"} ]}
 6  ],
 7  "coordinateTransformations": [ 
 8    { 
 9      "name": "projection down",
10      "type": "mapAxis", 
11      "mapAxis": { "x": "b" },
12      "input": "in",
13      "output": "out_down" 
14    },
15    { 
16      "name": "projection up",
17      "type": "mapAxis", 
18      "mapAxis": { "z": "b", "y": "b", "x": "a" },
19      "input": "in",
20      "output": "out_up" 
21    }
22  ]
23}

sequenceSubspace1#

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

translation#

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

inverseOf#

 1{
 2  "coordinateSystems" : [
 3    { "name" : "moving", "axes" : [{"name" : "y-moving"}, {"name":"x-moving"}] },
 4    { "name" : "fixed", "axes" : [{"name" : "y-fixed"}, {"name":"x-fixed"}] }
 5  ],
 6  "coordinateTransformations" : [
 7    {
 8      "type": "inverseOf",
 9      "transformation" : {
10        "type": "displacements",
11        "path": "path/to/displacements"
12      },
13      "input" : "moving",
14      "output" : "fixed"
15    }
16  ]
17}