Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 18 additions & 49 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,19 +403,15 @@ Coordinate transforms are in the "forward" direction.
This means they represent functions from *points* in the input space to *points* in the output space
(see [example below](#spec:example:coordinate_transformation_scale)).

They:

- MUST contain the field `type` (string).
- MUST contain any other fields required by the given `type` (see table below).
- MUST contain the field `output`, which is an object with fields `name` and `path`.
The `output` field MAY be omitted if the transformation is part of a wrapper transform
(i.e., [`sequence`](#sequence-md), [`bijection`](#bijection-md), [`byDimension`](#bydimension-md), see details).
- MUST contain the field `input`, which is an object with fields `name` and `path`.
The `input` field MAY be omitted if the transformation is part of a wrapper transform
(i.e., [`sequence`](#sequence-md), [`bijection`](#bijection-md), [`byDimension`](#bydimension-md), see details).
- MAY contain the field `name` (string).
Its value MUST be unique across all `name` fields for all coordinate transformations in the same list.
- Parameter values MUST be compatible with input and output space dimensionality (see details).
A transform is a JSON object with the following fields:

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `type` | string | yes | The type of the transformation, which determines the required and optional fields for that transformation. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion to replace the "required" column with a "requirement level" (or synonym), with MUST/SHOULD/MAY to match spec text.

| `name` | string | no | A unique name for this transformation. |
| `input` | object | yes, unless part of a wrapper transform ([`sequence`](#sequence-md), [`bijection`](#bijection-md), [`byDimension`](#bydimension-md)) | The input coordinate system for this transformation. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Type column, where the type is another object defined in this spec, should use that object's name and link to its definition. But we shouldn't try to change all the definitions into tables in this PR :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was tempting 😬 🙈

| `output` | object | yes, unless part of a wrapper transform ([`sequence`](#sequence-md), [`bijection`](#bijection-md), [`byDimension`](#bydimension-md)) | The output coordinate system for this transformation. |

The following transformations are supported:

| Type | Fields | Description |
Expand All @@ -432,39 +428,18 @@ The following transformations are supported:
| [`bijection`](#bijection-md) | `"forward":Transformation`<br>`"inverse":Transformation` | An invertible transformation providing an explicit forward transformation and its inverse. |
| [`byDimension`](#bydimension-md) | `"transformations":List[Transformation]`.<br>Transformations in the array MUST have<br>`"input_axes": List[number]`, <br> and `"output_axes": List[number]` | A high dimensional transformation using lower dimensional transformations on subsets of dimensions. |

Implementations SHOULD prefer to store transformations as a sequence of less expressive transformations where possible
(e.g., sequence[translation, rotation], instead of affine transformation with translation/rotation).

:::{dropdown} Example
(spec:example:coordinate_transformation_scale)=

```json
{
"coordinateSystems": [
{ "name": "in", "axes": [{"name": "j"}, {"name": "i"}] },
{ "name": "out", "axes": [{"name": "y"}, {"name": "x"}] }
],
"coordinateTransformations": [
{
"type": "scale",
"scale": [2, 3.12],
"input": {"name": "in"},
"output": {"name": "out"}
}
]
}
The parameter values (i.e., `scale` for a [scale transformatiion](#scale-md)) MUST be compatible with input and output space dimensionality (see details).

```
The `input` and `output` fields are objects structured as follows:

For example, the scale transformation above defines the function:
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | string | no | The name of the coordinate system. Required context-dependent ([see details](#coord-trafo-constraints)). |
| `path` | string | no | The path to a zarr group, if the coordinate system is defined in a different Zarr group. Required context-dependent ([see details](#coord-trafo-constraints)). |

```
x = 3.12 * i
y = 2 * j
```

i.e., the mapping from the first input axis to the first output axis is determined by the first scale parameter.
:::
Implementations SHOULD prefer to store transformations as a sequence of less expressive transformations where possible
(e.g., sequence[translation, rotation], instead of affine transformation with translation/rotation).

Conforming readers:
- MUST parse `identity`, `scale`, `translation` transformations;
Expand All @@ -475,6 +450,7 @@ Conforming readers:


**Constraints**
(coord-trafo-constraints)=

Coordinate transformations can be stored in multiple places to reflect different use cases.
Depending on which, different constraints apply to the transformations, as described below:
Expand Down Expand Up @@ -507,13 +483,6 @@ This separation of transformations (inside `multiscales > datasets`, under `mult

#### Additional details

**Omitting `input`/`output`**: Coordinate transformations MUST specify their input and output coordinate systems
using the `input` and `output` fields.
These fields MUST correspond to the name of a coordinate system or the path to a multiscales group.
Exceptions are if the coordinate transformation is wrapped in another transformation,
e.g. as part of a `sequence`, `byDimension` or `bijection`.
In these cases, the `input` and `output` fields MAY be omitted or null.

**Graph connectedness**: The coordinate systems defined in the [multiscales metadata](#multiscales-md)
and the [`scene` metadata](#scene-md) combined with the coordinate transformations form a transformations graph.
In this graph, coordinate systems represent nodes and coordinate transformations represent edges.
Expand Down
Loading