Skip to article frontmatterSkip to article content

transformations

This document contains JSON examples for transformations metadata layouts.

affine2d3d

affine2d3d.json
1
2
3
4
5
6
7
8
9
10
11
12
13
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"
        }
    ]
}

mapAxis2

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

byDimensionInvalid2

byDimensionInvalid2.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
    "coordinateSystems": [
        { "name": "in", "axes": [ {"name": "j"}, {"name": "i"} ] },
        { "name": "out", "axes": [ {"name": "y"}, {"name": "x"} ] }
    ],
    "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"]}
            ]
        }
    ]
}

bijection

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

displacement1d

displacement1d.json
1
2
3
4
5
6
7
8
9
10
11
12
13
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"
    }]
}

byDimensionInvalid1

byDimensionInvalid1.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
    "coordinateSystems": [
        { "name": "in", "axes": [ {"name": "j"}, {"name": "i"} ] },
        { "name": "out", "axes": [ {"name": "y"}, {"name": "x"} ] }
    ],
    "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"]}
            ]
        }
    ]
}

affine2d2d

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

inverseOf

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

byDimension2

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

xarrayLike

xarrayLike.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
    "coordinateSystems": [
        { "name": "in", "axes": [ {"name": "i", "type": "array"}, {"name": "j", "type": "array"} ]},
        { "name": "out", "axes": [ {"name": "x", "type": "space"}, {"name": "y", "type": "space"} ]}
    ],
    "coordinateTransformations": [ 
        {
            "type": "byDimension",
            "input": "in",
            "output": "out",
            "transformations": [
                { "type": "coordinates", "path": "/xCoordinates", "input" : ["i"], "output" : ["x"] },
                { "type": "coordinates", "path": "/yCoordinates", "input" : ["j"], "output" : ["y"] }
            ]
        }
    ]
}

translation

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

scale

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

rotation

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

byDimensionXarray

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

mapAxis1

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

sequenceSubspace1

sequenceSubspace1.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
    "coordinateSystems" : [
        { "name" : "in", "axes" : [ {"name" : "i"}, {"name" : "j"} ] },
        { "name" : "out", "axes" : [ {"name" : "x"}, {"name" : "y"} ] }
    ],
    "coordinateTransformations" : [
        {
            "type" : "sequence",
            "input" : "in",
            "output" : "out",
            "transformations" : [
                { "type" : "coordinates", "path" : "/coordinates", "inputAxes" : ["i"], "outputAxes" : ["x"]},
                { "type" : "scale", "scale" : [2.0], "inputAxes" : ["j"], "outputAxes" : ["y"]}
            ]
        }
    ]
}

sequence

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

byDimension1

byDimension1.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
    "coordinateSystems": [
        { "name": "in", "axes": [ {"name": "j"}, {"name": "i"} ] },
        { "name": "out", "axes": [ {"name": "y"}, {"name": "x"} ] }
    ],
    "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"]}
            ]
        }
    ]
}

bijection_verbose

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

coordinates1d

coordinates1d.json
1
2
3
4
5
6
7
8
9
10
11
12
13
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"
    }]
}

identity

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