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_path
filepath Path to morphology image that was segmented.
- labels_npz_path
filepath Path to sparse morphology labels generated by
b2c.stardist().- cdata
AnnData Cell-level VisiumHD object with pertinent gene/metadata. Must have
.obs_namesunchanged fromb2c.bin_to_cell()output.- fill_key
strorNone, optional (default:None) .obscolumn (float/integer or categorical) or gene name (expression taken from.X) to colour the fill by. Skipped ifNone.- border_key
strorNone, optional (default:None) .obscolumn (float/integer or categorical) or gene name (expression taken from.X) to colour the border by. Skipped ifNone.- crop
Noneor tuple ofint, 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_normalize
bool, optional (default:False) If
True, percentile normalise the input image prior to rendering the segmentation labels on it.- fill_label_weight
float, optional (default: 1) Weight to assign the object fill render when constructing output. 0 is completely transparent, 1 is completely opaque.
- thicken_border
bool, optional (default:True) The default identified border is thinner than that of
b2c.view_labels(). Setting this toTrue, thickens it for ease of viewing.- cat_cmap
str, optional (default:"tab20") Colormap name (must be understood by
seaborn.color_palette()) to use for categoricals.- cont_cmap
str, optional (default:"viridis") Colormap name (must be understood by
matplotlib.colormaps.get_cmap()) to use for integers/floats.
- image_path