diff --git a/latest/index.bs b/latest/index.bs index 0f23e9ce..736d5fa6 100644 --- a/latest/index.bs +++ b/latest/index.bs @@ -740,6 +740,43 @@ operation is requested that requires the inverse of a transformation that can no implementations MAY estimate an inverse, or MAY output a warning that the requested operation is unsupported. +#### Matrix transformations + +Two transformation types ([affine](#affine) and [rotation](#rotation)) are parametrized by matrices. Matrices are applied to +column vectors that represent points in the input coordinate system. The first (last) axis in a coordinate system is the top +(bottom) entry in the column vector. Matrices may be stored either as row-major flat (one-dimensional) arrays or two-dimensional +arrays, either in json or stored in a zarr array. When stored as a 2D zarr array, the first dimension indexes rows, and the +second dimension indexes columns (e.g., an array of `"shape":[3,4]` has 3 rows and 4 columns). When stored as a 2D json array, +the inner array contains rows (e.g. `[[1,2], [3,4], [5,6]]` has 3 rows and 2 columns). + +
+ +For matrix transformations, points in the coordinate system: + +``` +{ "name" : "in", "axes" : [{"name" : "z"}, {"name" : "y"}, {"name":"x"}] }, +``` + +are represented as column vectors: + +``` +[z] +[y] +[x] +``` + +As a result, transforming the point `[z,y,x]=[1,2,3]` with the matrix `[[0,1,0],[-1,0,0],[0,0,-1]]` +results in the point [2,-1,3] because it is computed with the matrix-vector multiplication: + +``` +[ 0 1 0] [1] [ 2] +[-1 0 0] [2] = [-1] +[ 0 0 -1] [3] [-3] +``` + +
+ + ### Transformation types Input and output dimensionality may be determined by the value of the "input" and "output" fields, respectively. If the value @@ -888,7 +925,7 @@ y = 2 * j #### affine -`affine` transformations from N-dimensional inputs to M-dimensional outputs are represented at `(N)x(M+1)` +`affine`s are [matrix transformations](#matrix-transformations) from N-dimensional inputs to M-dimensional outputs are represented at `(N)x(M+1)` matrices in homogeneous coordinates. This transformation type is invertible when `N` equals `M`. The matrix may be stored as a 2D array (inner arrays represent the rows of the matrix) or as a 1D array (row-major). @@ -896,7 +933,7 @@ The matrix may be stored as a 2D array (inner arrays represent the rows of the m
path
The path to a zarr-array containing the affine parameters. The array at this path MUST be 1D or 2D. If 1D, its length MUST be `N*(M+1)`. - If 2D its size must be `N x (M+1)`.
+ If 2D its shape must be `N x (M+1)`.
affine
The affine parameters stored in JSON. The matrix may be stored as a row-major flat array of numbers that MUST be length `N*(M+1)`, or as 2D nested array where the outer array MUST be length `N` and the inner arrays MUST be length `M+1`.
@@ -949,20 +986,17 @@ The matrix may be stored as a 2D array (inner arrays represent the rows of the m #### rotation -`rotation` transformations are special cases of affine transformations. -When possible, a rotation transformation SHOULD be defined rather than -its equivalent affine. Input and output dimensionality (N) MUST be -identical and greater than 1. Rotations are stored as `NxN` matrices, -see below, and MUST have determinant equal to one, with orthonormal rows -and columns. The matrix may be stored as a 2D array (inner arrays represent -the rows of the matrix) or as a 1D array (row-major). `rotation` transformations -are invertible. +`affine`s are [matrix transformations](#matrix-transformations) that are special cases of affine transformations. When possible, a rotation +transformation SHOULD be preferred to its equivalent affine. Input and output dimensionality (N) MUST be identical and greater +than 1. Rotations are stored as `NxN` matrices, see below, and MUST have determinant equal to one, with orthonormal rows and +columns. The matrix may be stored as a 2D array (inner arrays represent the rows of the matrix) or as a 1D array (row-major). +`rotation` transformations are invertible.
path
The path to an array containing the affine parameters. The array at this path MUST be 1D or 2D. If 1D, its length MUST be `N*N`, - if 2D its size must be `N x N`.
+ if 2D its shape must be `N x N`.
rotation
The parameters stored in JSON. The matrix may be stored as a row-major flat array of numbers that MUST be length `N*N`, or as 2D nested array where the outer array MUST be length `N` and the inner arrays MUST be length `N`.