bin2cell.view_cell_labels

bin2cell.view_cell_labels(image_path, labels_npz_path, cdata, fill_key=None, border_key=None, crop=None, stardist_normalize=False, fill_label_weight=1, thicken_border=True, cat_cmap='tab20', cont_cmap='viridis')

Colour morphology segmentations by cell-level metadata or gene expression. Can do fills or borders. Returns image as np.array, and a dictionary of legends (as matplotlib figures) named after the keys it used.

Input

image_pathfilepath

Path to morphology image that was segmented.

labels_npz_pathfilepath

Path to sparse morphology labels generated by b2c.stardist().

cdataAnnData

Cell-level VisiumHD object with pertinent gene/metadata. Must have .obs_names unchanged from b2c.bin_to_cell() output.

fill_keystr or None, optional (default: None)

.obs column (float/integer or categorical) or gene name (expression taken from .X) to colour the fill by. Skipped if None.

border_keystr or None, optional (default: None)

.obs column (float/integer or categorical) or gene name (expression taken from .X) to colour the border by. Skipped if None.

cropNone or tuple of int, optional (default: None)

A PIL-formatted crop specification - a four integer tuple, provided as (left, upper, right, lower) coordinates. If None, will render full segmentation results.

stardist_normalizebool, optional (default: False)

If True, percentile normalise the input image prior to rendering the segmentation labels on it.

fill_label_weightfloat, optional (default: 1)

Weight to assign the object fill render when constructing output. 0 is completely transparent, 1 is completely opaque.

thicken_borderbool, optional (default: True)

The default identified border is thinner than that of b2c.view_labels(). Setting this to True, thickens it for ease of viewing.

cat_cmapstr, optional (default: "tab20")

Colormap name (must be understood by seaborn.color_palette()) to use for categoricals.

cont_cmapstr, optional (default: "viridis")

Colormap name (must be understood by matplotlib.colormaps.get_cmap()) to use for integers/floats.