zarrsmith.utils.visualize
Functions
|
Convert an OME int, hex string or color name to an RGB float tuple for napari. |
|
|
|
Per-axis units for napari layers covering the axes |
|
Units of the axes shown by an image/label layer (channel axis optionally removed). |
|
|
|
Visualize an axis-aware multiscale dataset with napari. |
|
Names of the |
|
|
|
Add a dataset to |
Module Contents
- zarrsmith.utils.visualize._parse_color(color: int | str) tuple[float, float, float][source]
Convert an OME int, hex string or color name to an RGB float tuple for napari.
- zarrsmith.utils.visualize._axis_scale(metadata: Dict[str, Any], axes: tuple[str, ...], level: int, *, drop_channel: bool) tuple[float, ...][source]
- zarrsmith.utils.visualize.units_for_axes(metadata: Dict[str, Any], requested: Iterable[str])[source]
Per-axis units for napari layers covering the axes
requested, orNone.Layers added without units default to
pixel. napari then disables units for rendering (“Inconsistent units across layers”) as soon as it also holds layers with physical units. Every layer that ZarrSmith adds, image or helper (ROI, Z range…), therefore takes its units from here so they all agree with each other and with a converted zarr opened bynapari-ome-zarr.Noneis returned (so the caller omitsunits) when napari has no layer units or a unit cannot be parsed.
- zarrsmith.utils.visualize._axis_units(metadata: Dict[str, Any], axes: tuple[str, ...], *, drop_channel: bool)[source]
Units of the axes shown by an image/label layer (channel axis optionally removed).
- zarrsmith.utils.visualize._set_axis_labels(viewer, axes: tuple[str, ...], *, drop_channel: bool) None[source]
- zarrsmith.utils.visualize.visualize(data_levels: List[dask.array.Array], metadata: Dict[str, Any], start_level: int = 0, stop_level: int = -1, in_memory: bool = False, viewer: napari.Viewer | None = None) napari.Viewer | None[source]
Visualize an axis-aware multiscale dataset with napari.
Datasets without a
taxis are passed to napari without an artificial time dimension, so napari will not expose an active T slider. Datasets without acaxis are displayed as a single image/label layer rather than channel layers.
- zarrsmith.utils.visualize.channel_names(metadata: Dict[str, Any], n: int) list[str][source]
Names of the
nchannels of a dataset (ch_0,ch_1, … when not in its metadata).
- zarrsmith.utils.visualize.layer_geometry(metadata: Dict[str, Any], axes, level: int = 0, *, drop_channel: bool) Dict[str, Any][source]
scale(andunits, when known) of a napari layer showinglevelof a dataset.
- zarrsmith.utils.visualize.add_layers(viewer, data_levels: List[Any], metadata: Dict[str, Any], *, level: int = 0, name: str | None = None, **kwargs) list[source]
Add a dataset to
viewerand return its layers: one labels layer for label data, else one image layer per channel (named"<name>: <channel>"whennameis given).data_levelsare the levels shown (level: the first one’s index in the dataset). The colours are the channel colours of the metadata (gray without them);kwargsgo to napari and replace any of these settings (e.g.contrast_limits,blending,colormap).