squidpy.im.ImageContainer.features_histogram

ImageContainer.features_histogram(layer, library_id=None, feature_name='histogram', channels=None, bins=10, v_range=None)

Compute histogram counts of color channel values.

Returns one feature per bin and channel.

Parameters:
  • layer (str) – Image layer in img that should be processed. If None and only 1 layer is present, it will be selected.

  • library_id (Optional[str]) – Name of the Z-dimension that this function should be applied to.

  • feature_name (str) – Base name of feature in resulting feature values dict.

  • channels (Union[int, Sequence[int], None]) – Channels for this feature is computed. If None, use all channels.

  • bins (int) – Number of binned value intervals.

  • v_range (Optional[tuple[int, int]]) – Range on which values are binned. If None, use the whole image range.

Return type:

dict[str, Any]

Returns:

: Returns features with the following keys for each channel c in channels:

  • '{feature_name}_ch-{c}_bin-{i}' - the histogram counts for each bin i in bins.