phenotypic.sdk_.load_image_from_store#

phenotypic.sdk_.load_image_from_store(store_path: Path, *, fallback: ImageTypeName = 'Image') _Image | _GridImage[source]#

Read phenotypic.image_class from a store root and dispatch the loader.

Dispatches on image_class (Image / GridImage), which is the loader-dispatch field. It is not Metadata_ImageType, which is user-visible schema metadata and may be GridSection on a plain Image.

Bypasses the public :meth:`Image.load_zarr` guard, deliberately. That guard refuses a store carrying no image_class, because a user calling the public verb on such a store has almost certainly mistaken a --mode process export for a run bundle and wants imread instead. This function is the internal dispatcher: its caller supplies fallback and has therefore already made that determination itself (_cli_process_single passes the run’s own image type; the tune CLI passes "GridImage"). Routing through load_zarr would raise before the resolved class could ever be used, making fallback dead code. So the resolved class is asked to load the store directly.

A store with no bundle content still fails, one layer down and by its own error: _load_from_store subscripts the series mapping bare at series["gray"] and series["detect_mat"] (_image_io_handler.py), so a single-series process store raises KeyError: 'detect_mat'.

Parameters:
  • store_path (Path) – Path to a *.ome.zarr directory.

  • fallback (ImageTypeName) – Class name used when the block carries no image_class.

Returns:

An Image or GridImage loaded from the store.

Raises:
  • KeyError – If the store root carries no phenotypic block, or if it carries one but no bundle series.

  • ValueError – If store_schema_version is not this build’s.

Return type:

_Image | _GridImage