scallops.visualize.segmentation.plot_segmentation
- scallops.visualize.segmentation.plot_segmentation(data, dpi=300, titles=None, save_to_file=None, plot_cols=None, fontsize=None, **kwargs)
Plot basic segmentation results.
- Parameters:
data (Sequence[ndarray]) – List of segmented images as ndarrays.
dpi (int) – Requested DPI (only relevant if saving to file).
titles (None | Sequence[str]) – Optional list of titles. Must be the same length as the number of stacks to plot.
save_to_file (None | str) – Optional filename of the output file (format will be taken from the extension).
plot_cols (None | int) – Number of columns to plot.
fontsize (None | int) – Size of the titles’ font.
kwargs – Extra keyword arguments for plt.subplots.Axes.
- Example:
import numpy as np from scallops.visualize.segmentation import plot_segmentation # Create synthetic segmented images segmentations = [ np.random.rand(100, 100) > 0.5, np.random.rand(100, 100) > 0.5, np.random.rand(100, 100) > 0.5, ] # Plot segmentation results plot_segmentation( data=segmentations, dpi=150, titles=["Segmentation 1", "Segmentation 2", "Segmentation 3"], fontsize=12, ) plt.show()