Skip to content

Replace create_empty_hcs_zarr with iohub's create_empty_plate #540

Closed

Description

@tayllatheodoro

Summary

create_empty_hcs_zarr in waveorder/cli/utils.py can be replaced by create_empty_plate from iohub.ngff.utils. The core logic is identical.

Details

Both functions:

  1. Call open_ome_zarr(..., layout="hcs", mode="a") to create/open a plate
  2. Loop over position_keys, check if each exists in output_plate.zgroup
  3. If missing: create_position() → create_zeros() with a TransformationMeta scale transform
  4. If existing: append any missing channel names via append_channel()

create_empty_plate in iohub additionally supports:

  • Auto-calculated chunk sizes (via _limit_zyx_chunk_size)
  • Sharding (v0.5)
  • max_chunk_size_bytes parameter

Migration note

The one feature in create_empty_hcs_zarr not present in create_empty_plate is the plate_metadata parameter, which is used in apply_inverse_transfer_function.py to copy non-OME plate-level metadata. This needs to be handled separately after the call:

create_empty_plate(
    store_path, position_keys, channel_names, shape,
    chunks=chunks, scale=scale, dtype=dtype
)
if plate_metadata:
    with open_ome_zarr(str(store_path), mode="a") as plate:
        plate.zattrs.update(plate_metadata)

Alternatively, plate_metadata support could be added to create_empty_plate in iohub to make the replacement fully seamless.

Related

Activity

  1. ieivanov commented on Apr 15, 2026

    @ieivanov
    Contributor

    Related: deprecate apply_inverse_to_zyx_and_save and use the iohub version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions