API¶
Image writer utility
-
ome_zarr.writer.
write_image
(image: numpy.ndarray, group: zarr.hierarchy.Group, chunks: Union[Tuple[Any, ...], int] = None, byte_order: Union[str, List[str]] = 'tczyx', scaler: ome_zarr.scale.Scaler = Scaler(copy_metadata=False, downscale=2, in_place=False, labeled=False, max_layer=4, method='nearest'), fmt: ome_zarr.format.Format = FormatV04, axes: Union[str, List[str], List[Dict[str, str]]] = None, coordinate_transformations: List[List[Dict[str, Any]]] = None, storage_options: Union[Dict[str, Any], List[Dict[str, Any]]] = None, **metadata) → None¶ Writes an image to the zarr store according to ome-zarr specification
- image: np.ndarray
- the image data to save. A downsampling of the data will be computed if the scaler argument is non-None. Image array MUST be up to 5-dimensional with dimensions ordered (t, c, z, y, x)
- group: zarr.Group
- the group within the zarr store to store the data in
- chunks: int or tuple of ints,
- size of the saved chunks to store the image
- byte_order: str or list of str, default “tczyx”
- combination of the letters defining the order in which the dimensions are saved
- scaler: Scaler
- Scaler implementation for downsampling the image argument. If None, no downsampling will be performed.
- fmt: Format
- The format of the ome_zarr data which should be used. Defaults to the most current.
- axes: str or list of str or list of dict
- List of axes dicts, or names. Not needed for v0.1 or v0.2 or if 2D. Otherwise this must be provided
- coordinate_transformations: 2Dlist of dict
- For each resolution, we have a List of transformation Dicts (not validated). Each list of dicts are added to each datasets in order.
- storage_options: dict or list of dict
- Options to be passed on to the storage backend. A list would need to match the number of datasets in a multiresolution pyramid. One can provide different chunk size for each level of a pyramind using this option.
-
ome_zarr.writer.
write_multiscale
(pyramid: List, group: zarr.hierarchy.Group, chunks: Union[Tuple[Any, ...], int] = None, fmt: ome_zarr.format.Format = FormatV04, axes: Union[str, List[str], List[Dict[str, str]]] = None, coordinate_transformations: List[List[Dict[str, Any]]] = None, storage_options: Union[Dict[str, Any], List[Dict[str, Any]]] = None) → None¶ Write a pyramid with multiscale metadata to disk.
- pyramid: List of np.ndarray
- the image data to save. Largest level first All image arrays MUST be up to 5-dimensional with dimensions ordered (t, c, z, y, x)
- group: zarr.Group
- the group within the zarr store to store the data in
- chunks: int or tuple of ints,
- size of the saved chunks to store the image
- fmt: Format
- The format of the ome_zarr data which should be used. Defaults to the most current.
- axes: str or list of str or list of dict
- List of axes dicts, or names. Not needed for v0.1 or v0.2 or if 2D. Otherwise this must be provided
- coordinate_transformations: 2Dlist of dict
- For each path, we have a List of transformation Dicts. Each list of dicts are added to each datasets in order and must include a ‘scale’ transform.
- storage_options: dict or list of dict
- Options to be passed on to the storage backend. A list would need to match the number of datasets in a multiresolution pyramid. One can provide different chunk size for each level of a pyramind using this option.
-
ome_zarr.writer.
write_multiscales_metadata
(group: zarr.hierarchy.Group, datasets: List[dict], fmt: ome_zarr.format.Format = FormatV04, axes: Union[str, List[str], List[Dict[str, str]]] = None) → None¶ Write the multiscales metadata in the group.
- group: zarr.Group
- the group within the zarr store to write the metadata in.
- datasets: list of dicts
- The list of datasets (dicts) for this multiscale image. Each dict must include ‘path’ and a ‘coordinateTransformations’ list for version 0.4 or later that must include a ‘scale’ transform.
- fmt: Format
- The format of the ome_zarr data which should be used. Defaults to the most current.
- axes: list of str or list of dicts
- the names of the axes. e.g. [“t”, “c”, “z”, “y”, “x”]. Ignored for versions 0.1 and 0.2. Required for version 0.3 or greater.
-
ome_zarr.writer.
write_plate_metadata
(group: zarr.hierarchy.Group, rows: List[str], columns: List[str], wells: List[Union[str, dict]], fmt: ome_zarr.format.Format = FormatV04, acquisitions: List[dict] = None, field_count: int = None, name: str = None) → None¶ Write the plate metadata in the group.
- group: zarr.Group
- the group within the zarr store to write the metadata in.
- rows: list of str
- The list of names for the plate rows
- columns: list of str
- The list of names for the plate columns
- wells: list of str or dict
- The list of paths for the well groups
- fmt: Format
- The format of the ome_zarr data which should be used. Defaults to the most current.
- name: str
- The plate name
- field_count: int
- The maximum number of fields per view across wells
- acquisitions: list of dict
- A list of the various plate acquisitions
-
ome_zarr.writer.
write_well_metadata
(group: zarr.hierarchy.Group, images: List[Union[str, dict]], fmt: ome_zarr.format.Format = FormatV04) → None¶ Write the well metadata in the group.
- group: zarr.Group
- the group within the zarr store to write the metadata in.
- image_paths: list of str or dict
- The list of paths for the well images
- image_acquisitions: list of int
- The list of acquisitions for the well images
- fmt: Format
- The format of the ome_zarr data which should be used. Defaults to the most current.