Skip to content

Commit 6de3110

Browse files
committed
WIP: DOC: Improved Python interface docs
1 parent b7f5975 commit 6de3110

File tree

3 files changed

+27
-13
lines changed

3 files changed

+27
-13
lines changed

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ A lean and kind
2929
3030
quick_start.md
3131
installation.md
32-
array_api.md
32+
python.md
3333
cli.md
3434
itk.md
3535
methods.md

docs/itk.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Bidirectional type conversion that preserves spatial metadata is available with
88
Once represented as an `NgffImage`, a multiscale representation can be generated
99
with `to_multiscales`. And an OME-Zarr can be generated from the multiscales
1010
with `to_ngff_zarr`. For more information, see the
11-
[Python Array API documentation](./array_api.md).
11+
[Python interface documentation](./python.md).
1212

1313
## ITK Python
1414

docs/array_api.md renamed to docs/python.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,30 @@
1-
# 🐍 Python Array API
1+
# 🐍 Python Interface
22

3-
NGFF-Zarr supports conversion of any NumPy array-like object that follows the
4-
[Python Array API Standard](https://data-apis.org/array-api/latest/) into
5-
OME-Zarr. This includes such objects an NumPy `ndarray`'s, Dask Arrays, PyTorch
6-
Tensors, CuPy arrays, Zarr array, etc.
3+
NGFF-Zarr is a Python library that provides a simple, natural interface for
4+
working with OME-Zarr data structures, creating chunked, multiscale OME-Zarr
5+
image pyramids, and reading and writing OME-Zarr multiscale image files.
6+
7+
NGFF-Zarr's interface, which reflects the OME-Zarr data model, is built on
8+
Python's built-in [dataclasses] and [Dask arrays]. It is designed to be simple,
9+
flexible, and easy to use.
710

811
## Array to NGFF Image
912

10-
Convert the array to an `NgffImage`, which is a standard
11-
[Python dataclass](https://docs.python.org/3/library/dataclasses.html) that
12-
represents an OME-Zarr image for a single scale.
13+
NGFF-Zarr supports conversion of any NumPy array-like object that follows the
14+
[Python Array API Standard] into the OME-Zarr data model. This includes such
15+
objects an NumPy `ndarray`'s, Dask Arrays, PyTorch Tensors, CuPy arrays, Zarr
16+
array, etc.
17+
18+
Convert the array to an [`NgffImage`], which is a standard Python [dataclass]
19+
that represents an OME-Zarr image for a single scale.
1320

1421
When creating the image from the array, you can specify
1522

1623
- names of the `dims` from `{‘t’, ‘z’, ‘y’, ‘x’, ‘c’}`
1724
- the `scale`, the pixel spacing for the spatial dims
1825
- the `translation`, the origin or offset of the center of the first pixel
1926
- a `name` for the image
20-
- and `axes_units` with
21-
[UDUNITS-2 identifiers](https://ngff.openmicroscopy.org/latest/#axes-md)
27+
- and `axes_units` with [UDUNITS-2 identifiers]
2228

2329
```python
2430
>>> # Load an image as a NumPy array
@@ -152,7 +158,7 @@ scale according the OME-Zarr data model. Note that the correct `scale` and
152158

153159
## Write to Zarr
154160

155-
To write the multiscales to Zarr, use `to_ngff_zarr`.
161+
To write the multiscales to Zarr, use [`to_ngff_zarr`].
156162

157163
```python
158164
nz.to_ngff_zarr('cthead1.ome.zarr', multiscales)
@@ -165,3 +171,11 @@ Any other
165171
also be used.
166172

167173
The multiscales will be computed and written out-of-core, limiting memory usage.
174+
175+
[dataclass]: https://docs.python.org/3/library/dataclasses.html
176+
[dataclasses]: https://docs.python.org/3/library/dataclasses.html
177+
[Dask arrays]: https://docs.dask.org/en/stable/array.html
178+
[Python Array API Standard]: https://data-apis.org/array-api/latest/
179+
[UDUNITS-2 identifiers]: https://ngff.openmicroscopy.org/latest/#axes-md
180+
[`NgffImage`]: ./apidocs/ngff_zarr/ngff_zarr.ngff_image.html
181+
[`to_ngff_zarr`]: ./apidocs/ngff_zarr/ngff_zarr.to_ngff_zarr.html

0 commit comments

Comments
 (0)