-
Notifications
You must be signed in to change notification settings - Fork 15
Streamline input output constraints #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
b6ecb5e
f3a5fef
ebf814b
78d73f5
519cfc8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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. | | ||
| | `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. | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 :)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | | ||
|
|
@@ -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; | ||
|
|
@@ -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: | ||
|
|
@@ -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. | ||
|
|
||
There was a problem hiding this comment.
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.