harpy.io.phenocycler

Contents

harpy.io.phenocycler#

harpy.io.phenocycler(path, image_name='image', to_coordinate_system='global', to_micron_coordinate_system=None, channel_names=None, series=None, level=0, chunks=(1, 1024, 1024), image_models_kwargs=mappingproxy({}), output=None, overwrite=False)#

Read an Akoya/Quanterix PhenoCycler QPTIFF image as a spatialdata.SpatialData object.

The pixel data is loaded lazily through tifffile.imread() with return_as="zarr". QPTIFF metadata is read from TIFF tags and vendor XML descriptions; channel coordinates are taken from the XML Biomarker field when available, falling back to Name.

Parameters:
  • path (str | Path) – Path to the QPTIFF file.

  • image_name (str (default: 'image')) – Name of the image element in the returned SpatialData object.

  • to_coordinate_system (str (default: 'global')) – Pixel coordinate system assigned to the image element.

  • to_micron_coordinate_system (str | None (default: None)) – Physical coordinate system assigned through a scale transform in micrometers. Defaults to f"{to_coordinate_system}_micron" when physical pixel size metadata is available.

  • channel_names (Sequence[str] | None (default: None)) – Optional explicit channel names. If provided, the length must match the number of channels.

  • series (int | None (default: None)) – TIFF series index to read. If None, the first non-RGB CYX-like series is selected.

  • level (int (default: 0)) – Pyramid level to read. Defaults to full resolution.

  • chunks (str | tuple[int, ...] | int | None (default: (1, 1024, 1024))) – Optional Dask rechunking applied before creating the SpatialData image element. Defaults to (1, 1024, 1024). Pass None to keep the source/parser chunking.

  • image_models_kwargs (Mapping[str, Any] (default: mappingproxy({}))) – Additional keyword arguments passed to spatialdata.models.Image2DModel.parse(). If scale_factors is omitted, a size-based default is used. Pass {"scale_factors": None} to opt out.

  • output (str | Path | None (default: None)) – Optional path where the resulting SpatialData object should be written.

  • overwrite (bool (default: False)) – Whether to overwrite output when writing a backed SpatialData object.

Return type:

SpatialData

Returns:

: A SpatialData object containing one image element.

Notes

The returned unbacked object points lazily at the QPTIFF file. The underlying ZarrTiffStore is suitable for local Dask execution but is not pickleable; write to output first when a durable Zarr-backed SpatialData object or distributed execution is needed.