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": "zyx", "axes": [{"name": "z"}, {"name": "y"}, {"name": "x"}] }
  ],
  "coordinateTransformations": [ 
    {
      "type": "affine",
      "affine": [[1, 0, 0], [2, 3, 4], [5, 6, 7]],
      "input": "ij",
      "output": "zyx"
    }
  ]
}

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
18
19
20
21
22
23
24
25
26
27
{
  "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_axes": ["i"],
            "output_axes": ["x"]
        },
        {
            "type": "scale",
            "scale": [2.0],
            "input_axes": ["i"],
            "output_axes": ["x"]
        }
      ]
    }
  ]
}

bijection

bijection.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
  "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": "input", "axes": [{"name": "i"}] },
    { "name": "output", "axes": [{"name": "x"}] }
  ],
  "coordinateTransformations": [{
    "name": "a displacement field transform",
    "type": "displacements",
    "path": "i2xCoordinates",
    "input": "input",
    "output": "output",
    "interpolation": "nearest"
  }]
}

byDimensionInvalid1

byDimensionInvalid1.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
{
  "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_axes": ["i"],
          "output_axes": ["z"]
        },
        {
          "type": "scale",
          "scale": [2.0],
          "input_axes": ["0"],
          "output_axes": ["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_axes": [ "i", "k" ],
          "output_axes": [ "y", "x" ]
        },
        {
          "type": "scale",
          "scale": [ 2 ],
          "input_axes": [ "j" ],
          "output_axes": [ "z" ]
        }
      ]
    }
  ]
}

xarrayLike

xarrayLike.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
{
  "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_axes" : ["i"],
            "output_axes" : ["x"]
        },
        {
            "type": "coordinates",
            "path": "/yCoordinates",
            "input_axes" : ["j"],
            "output_axes" : ["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": [2, 3.12],
      "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"
    }
  ]
}

affine2d2d_with_channel

affine2d2d_with_channel.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
{
  "coordinateSystems" : [
    {
      "name": "cji",
      "axes": [
        {"name": "k", "discrete": true},
        {"name": "j", "discrete": false},
        {"name": "i", "discrete": false}
      ]
    },
    {
      "name": "cyx",
      "axes": [
        {"name": "c", "discrete": true},
        {"name": "y", "discrete": false},
        {"name": "x", "discrete": false}
      ]
    }
  ],
  "coordinateTransformations" : [ 
    {
      "type": "affine",
      "affine": [
        [1, 0, 0, 0],
        [0, 1, 2, 3],
        [0, 4, 5, 6]
      ],
      "input": "cji",
      "output": "cyx"
    }
  ]
}

scale_with_discrete

scale_with_discrete.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
{
  "coordinateSystems": [
    {
      "name": "in",
      "axes": [
        {"name": "k", "discrete": true},
        {"name": "j", "discrete": false},
        {"name": "i", "discrete": false}
      ]
    },
    {
      "name": "out",
      "axes": [
        {"name": "c", "discrete": true},
        {"name": "y", "discrete": false},
        {"name": "x", "discrete": false}
      ]
    }
  ],
  "coordinateTransformations": [ 
    {
      "type": "scale",
      "scale": [1, 3.12, 2],
      "input": "in",
      "output": "out"
    }
  ]
}

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_axes": [ "dim_0" ],
          "output_axes": [ "x" ]
        },
        {
          "type": "coordinates",
          "path": "yCoordinates",
          "input_axes": [ "dim_1" ],
          "output_axes": [ "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
18
19
20
21
22
23
24
25
26
27
{
  "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",
            "input_axes" : ["i"],
            "output_axes" : ["x"]
        },
        {
            "type" : "scale",
            "scale" : [2.0],
            "input_axes" : ["j"],
            "output_axes" : ["y"]
        }
      ]
    }
  ]
}

sequence

sequence.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": "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
18
19
20
21
22
23
24
25
26
27
{
  "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_axes": ["i"],
          "output_axes": ["x"]
        },
        {
          "type": "scale",
          "scale": [2.0],
          "input_axes": ["j"],
          "output_axes": ["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": "input", "axes": [{"name": "i"}] },
    { "name": "output", "axes": [{"name": "x"}] }
  ],
  "coordinateTransformations": [{
    "name": "a coordinate field transform",
    "type": "coordinates",
    "path": "i2xCoordinates",
    "input": "input",
    "output": "output",
    "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" }
  ]
}