You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: latest/index.bs
+82-24
Original file line number
Diff line number
Diff line change
@@ -107,6 +107,8 @@ Images {#image-layout}
107
107
108
108
The following layout describes the expected Zarr hierarchy for images with
109
109
multiple levels of resolutions and optionally associated labels.
110
+
Note that the number of dimensions is variable between 2 and 5 and that axis names are arbitrary, see [[#multiscale-md]] for details.
111
+
For this example we assume an image with 5 dimensions and axes called `t,c,z,y,x`.
110
112
111
113
<pre>
112
114
. # Root folder, potentially in S3,
@@ -127,7 +129,7 @@ multiple levels of resolutions and optionally associated labels.
127
129
│ │ # by the "multiscales" metadata, but is often a sequence starting at 0.
128
130
│ │
129
131
│ ├── .zarray # All image arrays must be up to 5-dimensional
130
-
│ │ # with dimension order (t, c, z, y, x).
132
+
│ │ # with the axis of type time before type channel, before spatial axes.
131
133
│ │
132
134
│ └─ t # Chunks are stored with the nested directory layout.
133
135
│ └─ c # All but the last chunk element are stored as directories.
@@ -207,49 +209,105 @@ Metadata {#metadata}
207
209
The various `.zattrs` files throughout the above array hierarchy may contain metadata
208
210
keys as specified below for discovering certain types of data, especially images.
209
211
212
+
"axes" metadata {#axes-md}
213
+
--------------------------
214
+
215
+
"axes" describes the dimensions of a physical coordinate space. It is a list of dictionaries, where each dictionary describes a dimension (axis) and:
216
+
- MUST contain the field "name" that gives the name for this dimension. The values MUST be unique across all "name" fields.
217
+
- SHOULD contain the field "type". It SHOULD be one of "space", "time" or "channel", but MAY take other values for custom axis types that are not part of this specification yet.
218
+
- SHOULD contain the field "unit" to specify the physical unit of this dimension. The value SHOULD be one of the following strings, which are valid units according to UDUNITS-2.
If part of [[#multiscale-md]], the length of "axes" MUST be equal to the number of dimensions of the arrays that contain the image data.
223
+
224
+
225
+
"transformations" metadata {#trafo-md}
226
+
-------------------------------------
227
+
228
+
"transformations" describes a series of transformations, e.g. to map discrete data space of an array to the corresponding physical space.
229
+
It is a list of dictionaries. Each entry describes a single transformation and MUST contain the field "type".
230
+
The value of "type" MUST be one of the elements of the `type` column in the table below.
231
+
Additional fields for the entry depend on "type" and are defined by the column `fields`.
232
+
233
+
| type | fields | description |
234
+
| ------------- | ------ |------------ |
235
+
| `identity` | | identity transformation, is the default transformation and is typically not explicitly defined |
236
+
| `translation` | one of: `"translation":List[float]`, `"path":str` | translation vector, stored either as a list of floats (`"translation"`) or as binary data at a location in this container (`path`). The length of vector defines number of dimensions. |
237
+
| `scale` | one of: `"scale":List[float]`, `"path":str` | scale vector, stored either as a list of floats (`scale`) or as binary data at a location in this container (`path`). The length of vector defines number of dimensions. |
238
+
239
+
In addition, the field "axisIndices" MAY be given to specify the subset of axes that the transformation is applied to, leaving other axes unchanged. If not given, the transformation is applied to all axes. The length of "axisIndices" MUST be equal to the dimensionality of the transformation. If "axisIndices" are not given, the dimensionality of the transformation MUST be equal to the number of dimensions of the space that the transformation is applied to.
240
+
If given, "axisIndices" MUST be given in increasing order. It uses zero-based indexing.
241
+
242
+
The transformations in the list are applied sequentally and in order.
243
+
244
+
210
245
"multiscales" metadata {#multiscale-md}
211
246
---------------------------------------
212
247
213
-
Metadata about the multiple resolution representations of the image can be
214
-
found under the "multiscales" key in the group-level metadata.
248
+
Metadata about an image can be found under the "multiscales" key in the group-level metadata. Here, image refers to 2 to 5 dimensional data representing image or volumetric data with optional time or channel axes. It is stored in a multiple resolution representation.
215
249
216
250
"multiscales" contains a list of dictionaries where each entry describes a multiscale image.
217
251
218
-
Each dictionary contained in the list MUST contain the field "datasets", which is a list of dictionaries describing
219
-
the arrays storing the individual resolution levels.
252
+
Each "multiscales" dictionary MUST contain the field "axes", see [[#axes-md]].
253
+
The length of "axes" must be between 2 and 5 and MUST be equal to the dimensionality of the zarr arrays storing the image data (see "datasets:path").
254
+
The "axes" MUST contain 2 or 3 entries of "type:space" and MAY contain one additional entry of "type:time" and MAY contain one additional entry of "type:channel" or a null / custom type.
255
+
The order of the entries MUST correspond to the order of dimensions of the zarr arrays. In addition, the entries MUST be ordered by "type" where the "time" axis must come first (if present), followed by the "channel" or custom axis (if present) and the axes of type "space".
256
+
If there are three spatial axes where two correspond to the image plane ("yx") and images are stacked along the other (anisotropic) axis ("z"), the spatial axes SHOULD be ordered as "zyx".
257
+
The values of the "name" fields must be given as a list in the field "_ARRAY_DIMENSIONS" in the attributes (.zattr) of the zarr arrays.
258
+
This ensures compatibility with the [xarray zarr encoding](http://xarray.pydata.org/en/stable/internals/zarr-encoding-spec.html#zarr-encoding).
259
+
E.g. for "axes: [{"name": "z"}, {"name": "y"}, {"name": x}]", the zarr arrays must contain "{"_ARRAY_DIMENSIONS": ["z", "y", "x"]}" in their attributes.
260
+
261
+
Each "multiscales" dictionary MUST contain the field "datasets", which is a list of dictionaries describing the arrays storing the individual resolution levels.
220
262
Each dictionary in "datasets" MUST contain the field "path", whose value contains the path to the array for this resolution relative
221
263
to the current zarr group. The "path"s MUST be ordered from largest (i.e. highest resolution) to smallest.
222
264
223
-
It MUST contain the field "axes", which is a list of dimension names of the axes.
224
-
The values MUST be unique and one of `{"t", "c", "z", "y", "x"}`.
225
-
The number of values MUST be the same as the number of dimensions of the arrays corresponding to this image.
226
-
In addition, the "axes" values MUST be repeated in the field "_ARRAY_DIMENSIONS" of all scale groups
227
-
(i.e. groups containing arrays with the multiscale data).
228
-
This ensures compatibility with the [xarray zarr encoding](http://xarray.pydata.org/en/stable/internals/zarr-encoding-spec.html#zarr-encoding).
265
+
Each "datasets" dictionary MUST have the same number of dimensions and MUST NOT have more than 5 dimensions. The number of dimensions and order MUST correspond to number and order of "axes".
266
+
Each dictionary MAY contain the field "transformations", which contains a list of transformations that map the data coordinates to the physical coordinates (as specified by "axes") for this resolution level.
267
+
The transformations are defined according to [[#trafo-md]]. In addition, the transformation types MUST only be `identity`, `translation` or `scale`.
268
+
They MUST contain at most one `scale` transformation per axis that specifies the pixel size in physical units.
269
+
It also MUST contain at most one `translation` per axis that specifies the offset from the origin in physical units.
270
+
If both `scale` and `translation` are given `translation` must be listed after `scale` to ensure that it is given in physical coordinates. If "transformations" is not given, the identity transformation is assumed.
271
+
The requirements (only `scale` and `translation`, restrictions on order) are in place to provide a simple mapping from data coordinates to physical coordinates while
272
+
being compatible with the general transformation spec.
229
273
230
-
It SHOULD contain the field "name".
274
+
Each "multiscales" dictionary MAY contain the field "transformations", describing transformations that are applied to each resolution level.
275
+
The transformations MUST follow the same rules about allowed types, order, etc. as in "datasets:transformations".
276
+
These transformations are applied after the per resolution level transformations specified in "datasets". They can for example be used to specify the `scale` for a dimension that is the same for all resolutions.
231
277
232
-
It SHOULD contain the field "version", which indicates the version of the
233
-
multiscale metadata of this image (current version is 0.3).
234
-
235
-
It SHOULD contain the field "type", which gives the type of downscaling method used to generate the multiscale image pyramid.
278
+
Each "multiscales" dictionary SHOULD contain the field "name". It SHOULD contain the field "version", which indicates the version of the multiscale metadata of this image (current version is 0.4).
236
279
280
+
Each "multiscales" dictionary SHOULD contain the field "type", which gives the type of downscaling method used to generate the multiscale image pyramid.
237
281
It SHOULD contain the field "metadata", which contains a dictionary with additional information about the downscaling method.
"transformations": [{"type": "scale", "scale": [0.5, 0.5, 0.5], "axisIndices": [2, 3, 4]}] # the voxel size for the first scale level (0.5 micrometer)
300
+
}
301
+
{
302
+
"path": "1",
303
+
"transformations": [{"type": "scale", "scale": [1.0, 1.0, 1.0], "axisIndices": [2, 3, 4]}] # the voxel size for the second scale level (downscaled by a factor of 2 -> 1 micrometer)
304
+
},
305
+
{
306
+
"path": "2",
307
+
"transformations": [{"type": "scale", "scale": [2.0, 2.0, 2.0], "axisIndices": [2, 3, 4]}] # the voxel size for the second scale level (downscaled by a factor of 4 -> 2 micrometer)
308
+
}
252
309
],
310
+
"transformations": [{"type": "scale", "scale": [0.1], "axisIndices": [0]], # the time unit (0.1 milliseconds), which is the same for each scale level
253
311
"type": "gaussian",
254
312
"metadata": { # the fields in metadata depend on the downscaling implementation
255
313
"method": "skimage.transform.pyramid_gaussian", # here, the paramters passed to the skimage function are given
0 commit comments