Skip to content

Commit 2a9412e

Browse files
authored
Merge pull request #118 from thewtex/from-ngff-zarr-docs
from ngff zarr docs
2 parents 4ef8972 + 659fd7b commit 2a9412e

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

docs/python.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,42 @@ chunksize=(64, 64), chunktype=numpy.ndarray>,
152152
)
153153
```
154154

155-
The `Multiscales` dataclass stores all the images and their metadata for each
155+
The [`Multiscales`] dataclass stores all the images and their metadata for each
156156
scale according the OME-Zarr data model. Note that the correct `scale` and
157157
`translation` for each scale are automatically computed.
158158

159-
## Write to Zarr
159+
## Read an OME-Zarr
160160

161-
To write the multiscales to Zarr, use [`to_ngff_zarr`].
161+
To read an OME-Zarr file, use [`from_ngff_zarr`], which returns the
162+
[`Multiscales`] dataclass.
163+
164+
```python
165+
>>> multiscales = nz.from_ngff_zarr('cthead1.ome.zarr')
166+
```
167+
168+
OME-Zarr version 0.1 to 0.5 is supported.
169+
170+
## Validate OME-Zarr metadata
171+
172+
To validate that an OME-Zarr's metadata following the specification's data
173+
model, which is used by all the programming languages in the community, use the
174+
`validate` optional dependency and kwarg to [`from_ngff_zarr`].
175+
176+
```shell
177+
pip install "ngff-zarr[validate]"
178+
```
179+
180+
```python
181+
>>> multiscales = nz.from_ngff_zarr('cthead1.ome.zarr', validate=True)
182+
```
183+
184+
If the metadata does not follow the data model, an error will be raised.
185+
186+
Metadata validation is supported for OME-Zarr version 0.1 to 0.5.
187+
188+
## Write an OME-Zarr
189+
190+
To write the multiscales to OME-Zarr, use [`to_ngff_zarr`].
162191

163192
```python
164193
nz.to_ngff_zarr('cthead1.ome.zarr', multiscales)
@@ -177,7 +206,9 @@ The multiscales will be computed and written out-of-core, limiting memory usage.
177206
[Dask arrays]: https://docs.dask.org/en/stable/array.html
178207
[Python Array API Standard]: https://data-apis.org/array-api/latest/
179208
[UDUNITS-2 identifiers]: https://ngff.openmicroscopy.org/latest/#axes-md
209+
[`Multiscales`]: ./apidocs/ngff_zarr/ngff_zarr.multiscales.md
180210
[`NgffImage`]: ./apidocs/ngff_zarr/ngff_zarr.ngff_image.md
181211
[`to_ngff_zarr`]: ./apidocs/ngff_zarr/ngff_zarr.to_ngff_zarr.md
182212
[`to_ngff_image`]: ./apidocs/ngff_zarr/ngff_zarr.to_ngff_image.md
183213
[`to_multiscales`]: ./apidocs/ngff_zarr/ngff_zarr.to_multiscales.md
214+
[`from_ngff_zarr`]: ./apidocs/ngff_zarr/ngff_zarr.from_ngff_zarr.md

0 commit comments

Comments
 (0)