save_masks#

cellpose_omni.io.save_masks(images, masks, flows, file_names, png=True, tif=False, suffix='', save_flows=False, save_outlines=False, outline_col=[1, 0, 0], save_ncolor=False, dir_above=False, in_folders=False, savedir=None, save_txt=True, save_plot=True, omni=True, channel_axis=None, channels=None)[source]#

save masks + nicely plotted segmentation image to png and/or tiff

if png, masks[k] for images[k] are saved to file_names[k]+'_cp_masks.png'

if tif, masks[k] for images[k] are saved to file_names[k]+'_cp_masks.tif'

if png and matplotlib installed, full segmentation figure is saved to file_names[k]+'_cp.png'

only tif option works for 3D data

Parameters
  • images ((list of) 2D, 3D or 4D arrays) -- images input into cellpose

  • masks ((list of) 2D arrays, int) -- masks output from cellpose_omni.eval, where 0=NO masks; 1,2,...=mask labels

  • flows ((list of) list of ND arrays) -- flows output from cellpose_omni.eval

  • file_names ((list of) str) -- names of files of images

  • savedir (str) -- absolute path where images will be saved. Default is none (saves to image directory)

  • save_flows (bool) -- Can choose which outputs/views to save. ncolor is a 4 (or 5, if 4 takes too long) index version of the labels that is way easier to visualize than having hundreds of unique colors that may be similar and touch. Any color map can be applied to it (0,1,2,3,4,...).

  • save_outlines (bool) -- Can choose which outputs/views to save. ncolor is a 4 (or 5, if 4 takes too long) index version of the labels that is way easier to visualize than having hundreds of unique colors that may be similar and touch. Any color map can be applied to it (0,1,2,3,4,...).

  • save_ncolor (bool) -- Can choose which outputs/views to save. ncolor is a 4 (or 5, if 4 takes too long) index version of the labels that is way easier to visualize than having hundreds of unique colors that may be similar and touch. Any color map can be applied to it (0,1,2,3,4,...).

  • save_txt (bool) -- Can choose which outputs/views to save. ncolor is a 4 (or 5, if 4 takes too long) index version of the labels that is way easier to visualize than having hundreds of unique colors that may be similar and touch. Any color map can be applied to it (0,1,2,3,4,...).