phenotypic.sdk_.load_image_from_hdf#
- phenotypic.sdk_.load_image_from_hdf(hdf_path: Path, *, fallback: ImageTypeName = 'Image') _Image | _GridImage[source]#
Open an HDF5, read its
phenotypic_classattr, dispatch to the right Image class.Replaces the 3 ad-hoc
h5py.File(...) → fh.attrs.get('phenotypic_class', 'Image') → GridImage if cls_attr == 'GridImage' else Imagepatterns in_cli_recompile_worker,_cli_execution_strategies, andphenotypicCLI.- Parameters:
hdf_path (Path) – Path to a per-image HDF5 file.
fallback (ImageTypeName) – Image class name to use when the HDF lacks the
phenotypic_classattribute (legacy files). Type-checked (statically) againstImageTypeName— there is no runtime validation; the only effect of an unrecognized string is that the dispatch falls through toImage.
- Returns:
An
ImageorGridImageinstance loaded from the HDF.- Return type:
_Image | _GridImage