cvpl_tools/ome_zarr/napari/add.py

View source at zarr.py.

For ome zarr images, subarray_from_path can be used generally. If an image has an associated label OME_ZARR file(s) in the “[image_ome_zarr]/labels/label_name” path, then the image and label(s) can be opened together with a single group_from_path call.

APIs

cvpl_tools.ome_zarr.napari.add.group(viewer: napari.Viewer, zarr_group: Group, merge_channels=True, kwargs: dict = None, lbl_kwargs: dict = None) napari.layers.Layer

Add an ome zarr image (if exists) along with its labels (if exist) to viewer.

Parameters:
  • viewer – Napari viewer object to attach image to

  • zarr_group – The zarr group that contains the ome zarr file

  • merge_channels – If True, display the image as one layers instead of a layer per channel

  • kwargs – dictionary, keyword arguments to be passed to viewer.add_image for root image

  • lbl_kwargs – dictionary, keyword arguments to be passed to viewer.add_image for label images

cvpl_tools.ome_zarr.napari.add.subarray(viewer: napari.Viewer, zarr_group: Group, merge_channels=True, start_level: int = 0, is_label=False, **kwargs) napari.layers.Layer

Add a multiscale ome zarr image or label to viewer.

The first channel is assumed to be the channel dimension. This is relevant only if merge_channels=False

Parameters:
  • viewer (napari.Viewer) – Napari viewer object to attach image to.

  • zarr_group (zarr.hierarchy.Group) – The zarr group that contains the ome zarr file.

  • merge_channels – If True, display the image as one layers instead of a layer per channel

  • start_level (int) – The lowest level (highest resolution) to be added, default to 0

  • is_label (bool) – If True, display the image as label; this is suitable for instance segmentation masks where the results need a distinct color for each number

  • **kwargs – Keyword arguments to be passed to viewer.add_image for root image.

cvpl_tools.ome_zarr.napari.add.group_from_path(viewer: napari.Viewer, path: str, use_zip: bool | None = None, merge_channels=True, kwargs=None, lbl_kwargs=None) napari.layers.Layer

Add an ome zarr group to napari viewer from given group path.

This is a combination of load_zarr_group_from_path() and add_ome_zarr_group() functions.

cvpl_tools.ome_zarr.napari.add.subarray_from_path(viewer: napari.Viewer, path: str, use_zip: bool | None = None, merge_channels=True, kwargs=None) napari.layers.Layer

Add an ome zarr array to napari viewer from given array path.

This is a combination of load_zarr_array_from_path() and add_ome_zarr_group() functions.