Skip to article frontmatterSkip to article content

transformations Examples

This document contains JSON examples for transformations metadata layouts.

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

rotation

rotation.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
  "coordinateSystems" : [
    {
      "name" : "ji",
      "axes" : [{"name" : "j", "type": "space"}, {"name":"i", "type": "space"}]
    },
    {
      "name" : "yx",
      "axes" : [{"name" : "y", "type": "space"}, {"name":"x", "type": "space"}]
    }
  ],
  "coordinateTransformations" : [
    {
      "type": "rotation",
      "rotation": [[0, -1], [1, 0]],
      "input" : {"name": "ji"},
      "output" : {"name": "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": "c", "discrete": true, "type": "channel"},
        {"name": "j", "discrete": false, "type": "space"},
        {"name": "i", "discrete": false, "type": "space"}
      ]
    },
    {
      "name": "cyx",
      "axes": [
        {"name": "c", "discrete": true, "type": "channel"},
        {"name": "y", "discrete": false, "type": "space"},
        {"name": "x", "discrete": false, "type": "space"}
      ]
    }
  ],
  "coordinateTransformations" : [ 
    {
      "type": "affine",
      "affine": [
        [1, 0, 0, 0],
        [0, 1, 2, 3],
        [0, 4, 5, 6]
      ],
      "input": {"name": "cji"},
      "output": {"name": "cyx"}
    }
  ]
}

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
28
29
30
31
32
33
34
35
36
37
{
  "coordinateSystems": [
    {
      "name": "in",
      "axes": [ {"name": "j", "type": "space"}, {"name": "i", "type": "space"} ]
    },
    {
      "name": "out",
      "axes": [ {"name": "y", "type": "space"}, {"name": "x", "type": "space"} ]
    }
  ],
  "coordinateTransformations": [
    {
      "type": "byDimension",
      "input": {"name": "in"},
      "output": {"name": "out"},
      "transformations": [
        {
          "transformation": {
            "type": "translation",
            "translation": [-1.0]
          },
          "inputAxes": [1],
          "outputAxes": [2]
        },
        {
          "transformation": {
            "type": "scale",
            "scale": [2.0]
          },
          "inputAxes": [0],
          "outputAxes": [2]
        }
      ]
    }
  ]
}

byDimensionCoordinates

byDimensionCoordinates.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
{
  "coordinateSystems" : [
    {
      "name" : "in",
      "axes" : [ {"name" : "i", "type": "space"}, {"name" : "j", "type": "space"} ]
    },
    {
      "name" : "out",
      "axes" : [ {"name" : "x", "type": "space"}, {"name" : "y", "type": "space"} ]
    }
  ],
  "coordinateTransformations" : [
    {
      "type" : "byDimension",
      "input" : {"name" : "in"},
      "output" : {"name" : "out"},
      "transformations" : [
        {
            "transformation" : {
              "type" : "coordinates",
              "path" : "/coordinates"
            },
            "inputAxes" : [0],
            "outputAxes" : [0]
        },
        {
            "transformation" : {
              "type" : "scale",
              "scale" : [2.0]
            },
            "inputAxes" : [1],
            "outputAxes" : [1]
        }
      ]
    }
  ]
}

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
40
41
42
43
{
  "coordinateSystems": [
    {
      "name": "physical",
      "axes": [
        { "name": "x", "type": "space", "unit": "micrometer" },
        { "name": "y", "type": "space", "unit": "micrometer" }
      ]
    },
    {
      "name": "array",
      "axes": [
        { "name": "dim_0", "type": "space" },
        { "name": "dim_1", "type": "space" }
      ]
    }
  ],
  "coordinateTransformations": [
    {
      "type": "byDimension",
      "input": {"name": "array"},
      "output": {"name": "physical"},
      "transformations": [
        {
          "transformation": {
            "type": "coordinates",
            "path": "xCoordinates"
          },
          "inputAxes": [ 0 ],
          "outputAxes": [ 0 ]
        },
        {
          "transformation": {
            "type": "coordinates",
            "path": "yCoordinates"
          },
          "inputAxes": [ 1 ],
          "outputAxes": [ 1 ]
        }
      ]
    }
  ]
}

bijection_verbose

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

bijection

bijection.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": "src",
      "axes": [{"name": "j", "type": "space"}, {"name": "i", "type": "space"}]
    },
    {
      "name": "tgt",
      "axes": [{"name": "y", "type": "space"}, {"name": "x", "type": "space"}]
    }
  ],
  "coordinateTransformations" : [ 
    {
      "type": "bijection",
      "forward": {
        "type" : "coordinates",
        "path" : "forward_coordinates"
      },
      "inverse": {
        "type" : "coordinates",
        "path" : "inverse_coordinates"
      },
      "input": {"name": "src"},
      "output": {"name": "tgt"}
    }
  ]
}

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
24
25
26
27
28
29
30
31
32
{
  "coordinateSystems": [
    {
      "name": "in",
      "axes": [ {"name": "j", "type": "space"}, {"name": "i", "type": "space"} ]
    },
    {
      "name": "out1",
      "axes": [ {"name": "y", "type": "space"}, {"name": "x", "type": "space"} ]
    },
    {
      "name": "out2",
      "axes": [ {"name": "y", "type": "space"}, {"name": "x", "type": "space"} ]
    }
  ],
  "coordinateTransformations": [
    {
      "name": "equivalent to identity",
      "type": "mapAxis",
      "mapAxis": [0, 1],
      "input": {"name": "in"},
      "output": {"name": "out1"}
    },
    {
      "name": "permutation",
      "type": "mapAxis",
      "mapAxis": [1, 0],
      "input": {"name": "in"},
      "output": {"name": "out2"}
    }
  ]
}

affine2d3d

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

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
28
29
30
31
32
33
34
35
36
37
38
{
  "coordinateSystems": [
    {
      "name": "in",
      "axes": [ {"name": "j", "type": "space"}, {"name": "i", "type": "space"} ]
    },
    {
      "name": "out",
      "axes": [ {"name": "y", "type": "space"}, {"name": "x", "type": "space"} ]
    }
  ],
  "coordinateTransformations": [
    {
      "type": "byDimension",
      "input": {"name": "in"},
      "output": {"name": "out"},
      "transformations": [
        {
          "transformation": {

            "type": "translation",
            "translation": [-1.0]
          },
          "inputAxes": [1],
          "outputAxes": [1]
        },
        {
          "transformation": {
            "type": "scale",
            "scale": [2.0]
          },
          "inputAxes": [1],
          "outputAxes": [1]
        }
      ]
    }
  ]
}

projectAxis2

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

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
43
44
45
46
{
  "coordinateSystems": [
    {
      "name": "in",
      "axes": [
        { "name": "l", "type": "space" },
        { "name": "j", "type": "space" },
        { "name": "k", "type": "space" },
        { "name": "i", "type": "space" }
      ]
    },
    {
      "name": "out",
      "axes": [
        { "name": "z", "type": "space" },
        { "name": "y", "type": "space" },
        { "name": "x", "type": "space" }
      ]
    }
  ],
  "coordinateTransformations": [
    {
      "type": "byDimension",
      "input": {"name": "in"},
      "output": {"name": "out"},
      "transformations": [
        {
          "transformation": {
            "type": "translation",
            "translation": [ 0.5, 1.5 ]
          },
          "inputAxes": [ 3, 2 ],
          "outputAxes": [ 1, 2 ]
        },
        {
          "transformation": {
            "type": "scale",
            "scale": [ 2 ]
          },
          "inputAxes": [ 1 ],
          "outputAxes": [ 0 ]
        }
      ]
    }
  ]
}

affine2d2d

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

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
24
25
26
27
28
29
{
  "coordinateSystems": [
    {
      "name": "in",
      "axes": [ {"name": "j", "type": "space"}, {"name": "i", "type": "space"} ]
    },
    {
      "name": "out",
      "axes": [ {"name": "y", "type": "space"}, {"name": "x", "type": "space"} ]
    }
  ],
  "coordinateTransformations": [ 
    {
      "type": "sequence",
      "input": {"name": "in"},
      "output": {"name": "out"},
      "transformations": [
        {
            "type": "translation",
            "translation": [0.1, 0.9]
        },
        {
            "type": "scale",
            "scale": [2, 3]
        }
      ]
    }
  ]
}

translation

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

identity

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

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
28
29
30
31
32
33
34
35
36
37
{
  "coordinateSystems": [
    {
      "name": "in",
      "axes": [ {"name": "j", "type": "space"}, {"name": "i", "type": "space"} ]
    },
    {
      "name": "out",
      "axes": [ {"name": "y", "type": "space"}, {"name": "x", "type": "space"} ]
    }
  ],
  "coordinateTransformations": [
    {
      "type": "byDimension",
      "input": {"name": "in"},
      "output": {"name": "out"},
      "transformations": [
        {
          "transformation": {
            "type": "translation",
            "translation": [-1.0]
          },
          "inputAxes": [1],
          "outputAxes": [1]
        },
        {
          "transformation": {
            "type": "scale",
            "scale": [2.0]
          },
          "inputAxes": [0],
          "outputAxes": [0]
        }
      ]
    }
  ]
}

scale

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

projectAxis

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

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
28
29
30
31
{
  "coordinateSystems": [
    { "name": "in", "axes": [ {"name": "i", "type": "space"}, {"name": "j", "type": "space"} ]},
    { "name": "out", "axes": [ {"name": "x", "type": "space"}, {"name": "y", "type": "space"} ]}
  ],
  "coordinateTransformations": [ 
    {
      "type": "byDimension",
      "input": {"name": "in"},
      "output": {"name": "out"},
      "transformations": [
        {
          "transformation": {
            "type": "coordinates",
            "path": "/xCoordinates"
          },
          "inputAxes" : [0],
          "outputAxes" : [0]
        },
        {
          "transformation": {
            "type": "coordinates",
            "path": "/yCoordinates"
          },
          "inputAxes" : [1],
          "outputAxes" : [1]
        }
      ]
    }
  ]
}