locpix.visualise.vis_img.visualise_seg#

visualise_seg(image, segmentation, bin_sizes, axes, label_map, threshold=0, how='linear', alphas=[1, 0.5, 0.2, 0.1], alpha_seg=0.8, blend_overlays=False, cmap_img=None, cmap_seg=['m', 'g', 'lightsalmon', 'r', 'b'], figsize=(10, 10), origin='upper', save=False, save_loc=None, save_name=None, four_colour=True, background_one_colour=False, legend=True, show=False, vmin_img=0, vmax_img=255, sum_chans=False)[source]#

Take in image and the associated segmentation and plot it, with option to convert to 4 colours and also option to choose to plot background as one particular colour (only relevant if four colour is true)

Parameters:
  • image (array) – Shape C x H x W Therefore to plot the first axis of the image we would just want to consider image[0]

  • segmentation (np.ndarray) – Array of integers where each represents unique label in the segmentation

  • bin_sizes (list) – List of sizes of the bins of the histogram

  • axes (list) – List of axes to plot

  • label_map (list) – List of labels associated with each axis

  • threshold (int) – Threshold applied to images when plotting

  • how (string) – Interpolation applied to image when plotting

  • alphas (list) – List of alpha to be used in plt.imshow

  • alpha_seg (float) – Value of alpha for segmentation

  • blend_overlays (bool) – Whether to blend img and seg

  • cmap_img (list) – List of cmaps to plot images (transpose of histograms)

  • cmap_seg (list) – List of cmaps to plot segmentations

  • figsize (tuple) – Tuple of figure size in 2D (x,y) sizes

  • origin (string) – Location of origin in plot, image convention is ‘upper’ but for cartesian use ‘lower’

  • save (bool) – Whether to save

  • save_loc (string) – Where to save if chosen to save

  • save_name (string) – Name of file

  • four_colour (bool) – Whether to convert localisations to 4 colour

  • background_one_colour (bool) – Whether to keep background as all same colour when doing 4 colour conversion

  • legend (bool) – Whether to include a legend

  • show (bool) – Whether to show img to screen

  • vmin_img (int) – vmin for plotting image

  • vmax_img (int) – vmax for plotting image

  • sum_chans (bool) – If true all image channels are summed and one image is plotted