bioio_conversion.converters.OmeZarrConverter

class bioio_conversion.converters.OmeZarrConverter(*, source: str, destination: str | None = None, scenes: int | List[int] | None = None, name: str | None = None, level_shapes: Sequence[int] | Sequence[Sequence[int]] | None = None, chunk_shape: Sequence[int] | Sequence[Sequence[int]] | None = None, shard_shape: Sequence[int] | Sequence[Sequence[int]] | None = None, compressor: BloscCodec | Codec | None = None, zarr_format: int | None = None, image_name: str | None = None, channels: List[Channel] | None = None, rdefs: Dict[str, Any] | None = None, creator_info: Dict[str, Any] | None = None, root_transform: Dict[str, Any] | None = None, axes_names: List[str] | None = None, axes_types: List[str] | None = None, axes_units: List[str | None] | None = None, physical_pixel_size: List[float] | None = None, num_levels: int | None = None, downsample_z: bool = False, memory_target: int | None = None, start_T_src: int | None = None, start_T_dest: int | None = None, tbatch: int | None = None, dtype: str | dtype | None = None, auto_dask_cluster: bool = False)[source]

OmeZarrConverter handles conversion of any BioImage‐supported format (TIFF, CZI, etc.) into OME-Zarr stores. Supports exporting one, many, or all scenes from a multi-scene file.

__init__(*, source: str, destination: str | None = None, scenes: int | List[int] | None = None, name: str | None = None, level_shapes: Sequence[int] | Sequence[Sequence[int]] | None = None, chunk_shape: Sequence[int] | Sequence[Sequence[int]] | None = None, shard_shape: Sequence[int] | Sequence[Sequence[int]] | None = None, compressor: BloscCodec | Codec | None = None, zarr_format: int | None = None, image_name: str | None = None, channels: List[Channel] | None = None, rdefs: Dict[str, Any] | None = None, creator_info: Dict[str, Any] | None = None, root_transform: Dict[str, Any] | None = None, axes_names: List[str] | None = None, axes_types: List[str] | None = None, axes_units: List[str | None] | None = None, physical_pixel_size: List[float] | None = None, num_levels: int | None = None, downsample_z: bool = False, memory_target: int | None = None, start_T_src: int | None = None, start_T_dest: int | None = None, tbatch: int | None = None, dtype: str | dtype | None = None, auto_dask_cluster: bool = False) None[source]

Initialize an OME-Zarr converter with flexible scene selection, pyramid construction, and chunk-sizing.

Parameters:
sourcestr

Path to the input image (any format supported by BioImage).

destinationOptional[str]

Directory in which to write the .ome.zarr output(s). If None, the converter will use the current working directory

scenesOptional[Union[int, List[int]]]

Which scene(s) to export: - None → export all scenes - int → a single scene index - List[int] → those specific scene indices

nameOptional[str]

Base name for output files (defaults to the source stem). When exporting multiple scenes, each file name is suffixed with the scene’s name.

level_shapesOptional[List[Tuple[int, …]]]

Explicit per-level, per-axis absolute shapes (level 0 first). Each tuple length must match the native axis count. If provided, convenience options like num_levels and downsample_z are ignored.

chunk_shapeOptional[Union[Tuple[int, …], Tuple[Tuple[int, …], …]]]

Chunk shape for Zarr arrays. Either a single shape applied to all levels (e.g., (1, 1, 16, 256, 256)) or per-level shapes. Writer validates.

shard_factorOptional[Tuple[int, …]]

Optional shard factor per axis (Zarr v3 only). Writer validates.

compressorOptional[Union[zarr.codecs.BloscCodec, numcodecs.abc.Codec]]

Compression codec. For v2 use numcodecs.Blosc; for v3 use zarr.codecs.BloscCodec.

zarr_formatOptional[int]

Target Zarr array format (2 or 3). None lets the writer choose its default.

image_nameOptional[str]

Image name to record in multiscales metadata. Defaults to the output base.

channelsOptional[List[Channel]]

Optional OMERO-style channel metadata. Only used when a 'c' axis exists. If omitted, minimal channel models are derived from the reader.

rdefsOptional[Dict[str, Any]]

Optional OMERO rendering defaults.

creator_infoOptional[Dict[str, Any]]

Optional “creator” metadata block (e.g., tool/version).

root_transformOptional[Dict[str, Any]]

Optional multiscale root coordinate transformation.

axes_namesOptional[List[str]]

Axis names to write; defaults to the native axis names from the reader.

axes_typesOptional[List[str]]

Axis types (e.g., ["time","channel","space",...]). Writer validates.

axes_unitsOptional[List[Optional[str]]]

Physical units per axis. Writer validates.

physical_pixel_sizeOptional[List[float]]

Physical scale at level 0 per axis. If omitted, values are derived from BioImage.scale for present axes.

num_levelsOptional[int]

Convenience: number of pyramid levels to generate (including level 0). If set, an XY half-pyramid is built by default: - 1 = only level 0 - 2 = level 0 + one XY half - 3 = level 0 + two XY halves, etc. If downsample_z is True, Z is downsampled along with XY at each level.

downsample_zbool, default = False

Whether to include the Z axis in downsampling when building levels via num_levels. Ignored if level_shapes is provided.

memory_targetOptional[int]

If set (bytes), suggests a single chunk shape derived from level-0 shape and dtype via chunk_size_from_memory_target. Writer may reuse or adjust per level.

start_T_srcOptional[int]

Source T index at which to begin reading from the BioImage. Default: use writer default.

start_T_destOptional[int]

Destination T index at which to begin writing into the store. Default: use writer default.

tbatchOptional[int]

Number of timepoints to transfer. If None, the converter writes as many as available in both source and destination.

dtypeOptional[Union[str, np.dtype]]

Override output data type; defaults to the reader’s dtype.

auto_dask_clusterbool

If True, automatically spin up a local Dask cluster with 8 workers (using Cluster(n_workers=8).start()) before any conv

Methods

__init__(*, source[, destination, scenes, ...])

Initialize an OME-Zarr converter with flexible scene selection, pyramid construction, and chunk-sizing.

convert()