smurf.plot_results¶
- smurf.plot_results(original_image, result_image, transparency=0.6, transparent_background=False, include_label=None, colors=None, dpi=1500, figsize=(20, 20), save=None)¶
Plots the original tissue image with cell type assignments overlayed.
This function visualizes the results of cell type assignments by overlaying them on the original tissue image. It handles cases where there are many cell types and adjusts the plot accordingly. Optionally, it includes a legend with cell type labels.
- Parameters:
original_image (numpy.ndarray) – The original tissue image as a NumPy array (normally use so.image_temp()).
result_image (numpy.ndarray) – An array where each pixel corresponds to a cell type label after processing (normally use so.pixels_cells).
transparency (float, optional) – The transparency level of the cell type overlay. Must be between 0 and 1. Defaults to 0.6.
transparent_background (bool, optional) – Whether to use a transparent background for the overlay. Defaults to False.
include_label (bool or None, optional) – Whether to include a legend with cell type labels. If None, the function decides based on the number of cell types. Defaults to None.
colors (list of tuples or None, optional) – A list of RGB tuples representing colors for each cell type. If None, a default color palette is used for up to 50 cell types. Defaults to None.
dpi (int, optional) – The resolution of the plot in dots per inch. Defaults to 1500.
figsize (tuple, optional) – The size of the figure in inches (width, height). Defaults to (20, 20).
save (str or None, optional) – The file path to save the figure. If None, the figure will not be saved. Defaults to None.
- Returns:
None. The function displays the plot and optionally saves it to a file.
- Return type:
None