bin2cell.overlay_onto_img

bin2cell.overlay_onto_img(img, labels_sparse, cdata, key, common_objects, fill_label_weight=1, cat_cmap='tab20', cont_cmap='viridis')

Helper function used by b2c.view_cell_labels() to actually overlay the metadata/expression onto the morphology image

Input

image_pathnumpy.array

Morphology image in Numpy array form.

labels_sparsescipy.sparse.coo_matrix

Processed to just the pixels to render,

cdataAnnData

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

keystr

.obs column (float/integer or categorical) or gene name (expression taken from .X) to colour the labels_sparse pixels by.

common_objectsnumpy.array of int

Object IDs to plot.

fill_label_weightfloat, optional (default: 1)

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

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.