cellpose_omni.models#

ARM

bool(x) -> bool

BD_MODEL_NAMES

Built-in mutable sequence.

C1_BD_MODELS

Built-in mutable sequence.

C1_MODELS

Built-in mutable sequence.

C2_BD_MODELS

Built-in mutable sequence.

C2_MODELS

Built-in mutable sequence.

C2_MODEL_NAMES

Built-in mutable sequence.

CP_MODELS

Built-in mutable sequence.

Cellpose([gpu, model_type, net_avg, device, ...])

main model which combines SizeModel and CellposeModel

CellposeModel([gpu, pretrained_model, ...])

param gpu

whether or not to save model to GPU, will check if GPU available

MODEL_DIR

Path subclass for non-Windows systems.

MODEL_NAMES

Built-in mutable sequence.

MXNET_ENABLED

bool(x) -> bool

OMNI_INSTALLED

bool(x) -> bool

SizeModel(cp_model[, device, pretrained_size])

linear regression model for determining the size of objects in image used to rescale before input to cp_model uses styles from cp_model

cache_model_path(basename)

deprecation_warning_cellprob_dist_threshold(...)

model_path(model_type, model_index, use_torch)

models_logger

Instances of the Logger class represent a single logging channel.

size_model_path(model_type, use_torch)

cellpose_omni.io#

check_dir(path)

get_image_files(folder[, mask_filter, ...])

find all images in a folder and if look_one_level_down all subfolders

get_label_files(img_names[, label_filter, ...])

Get the corresponding labels and flows for the given file images.

getname(path[, suffix])

imread(filename)

imsave(filename, arr)

imwrite(filename, arr, **kwargs)

load_links(filename)

Read a txt or csv file with label links. These should look like: 1,2 1,3 4,7 6,19 . . . Returns links as a set of tuples.

load_train_test_data(train_dir[, test_dir, ...])

Loads the training and optional test data for training runs.

logger_setup([verbose])

masks_flows_to_seg(images, masks, flows, ...)

save output of model eval to be loaded in GUI

outlines_to_text(base, outlines)

save_masks(images, masks, flows, file_names)

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

save_server([parent, filename])

Uploads a *_seg.npy file to the bucket.

save_to_png(images, masks, flows, file_names)

deprecated (runs io.save_masks with png=True)

write_links(savedir, basename, links)

Write label link file.

cellpose_omni.plot#

disk(med, r, Ly, Lx)

returns pixels of disk with radius r and center med

dx_to_circ(dP[, transparency, mask, ...])

dP is 2 x Y x X => 'optic' flow representation

image_to_rgb(img0[, channels, channel_axis, ...])

image is 2 x Ly x Lx or Ly x Lx x 2 - change to RGB Ly x Lx x 3

interesting_patch(mask[, bsize])

get patch of size bsize x bsize with most masks

mask_overlay(img, masks[, colors, omni])

overlay masks on image (set image to grayscale)

mask_rgb(masks[, colors])

masks in random rgb colors

outline_view(img0, maski[, boundaries, ...])

Generates a red outline overlay onto image.

show_segmentation(fig, img, maski, flowi[, ...])

plot segmentation results (like on website)

cellpose_omni.metrics#

aggregated_jaccard_index(masks_true, masks_pred)

AJI = intersection of all matched masks / union of all masks

average_precision(masks_true, masks_pred[, ...])

average precision estimation: AP = TP / (TP + FP + FN)

boundary_scores(masks_true, masks_pred, scales)

boundary precision / recall / Fscore

flow_error(maski, dP_net[, use_gpu, device])

error in flows from predicted masks vs flows predicted by network run on image

mask_ious(masks_true, masks_pred)

return best-matched masks

cellpose_omni.dynamics#

compute_masks(dP, cellprob[, bd, p, inds, ...])

compute masks using dynamics from dP, cellprob, and boundary

follow_flows(dP[, mask, inds, niter, ...])

define pixels and run dynamics to recover masks in 2D

get_masks(p[, iscell, rpad, flows, ...])

create masks using pixel convergence after running dynamics

labels_to_flows(labels[, files, use_gpu, ...])

convert labels (list of masks or flows) to flows for training model

map_coordinates(I, yc, xc, Y)

bilinear interpolation of image 'I' in-place with ycoordinates yc and xcoordinates xc to Y

masks_to_flows(masks[, use_gpu, device])

convert masks to flows using diffusion from center pixel

masks_to_flows_cpu(masks[, device])

convert masks to flows using diffusion from center pixel Center of masks where diffusion starts is defined to be the closest pixel to the median of all pixels that is inside the mask.

masks_to_flows_gpu(masks[, device])

convert masks to flows using diffusion from center pixel Center of masks where diffusion starts is defined using COM :param masks: labelled masks 0=NO masks; 1,2,...=mask labels :type masks: int, 2D or 3D array

remove_bad_flow_masks(masks, flows[, ...])

remove masks which have inconsistent flows

steps2D(p, dP, inds, niter[, omni, calc_trace])

run dynamics of pixels to recover masks in 2D

steps2D_interp(p, dP, niter[, use_gpu, ...])

steps3D(p, dP, inds, niter)

run dynamics of pixels to recover masks in 3D

cellpose_omni.transforms#

average_tiles(y, ysub, xsub, Ly, Lx)

average results of network over tiles

convert_image(x, channels[, channel_axis, ...])

return image with z first, channels last and normalized intensities

make_tiles(imgi[, bsize, augment, tile_overlap])

make tiles of image to run at test-time

move_axis(img[, m_axis, first])

move axis m_axis to first or last position

move_axis_new(a, axis, pos)

Move ndarray axis to new location, preserving order of other axes.

move_min_dim(img[, force])

move minimum dimension last as channels if < 10, or force==True

normalize99(Y[, lower, upper, omni])

normalize image so 0.0 is 0.01st percentile and 1.0 is 99.99th percentile

normalize_field(mu[, omni])

normalize_img(img[, axis, invert, omni])

normalize each channel of the image so that so that 0.0=1st percentile and 1.0=99th percentile of image intensities

original_random_rotate_and_resize(X[, Y, ...])

augmentation by random rotation and resizing X and Y are lists or arrays of length nimg, with dims channels x Ly x Lx (channels optional)

pad_image_ND(img0[, div, extra, dim])

pad image for test-time so that its dimensions are a multiple of 16 (2D or 3D)

random_rotate_and_resize(X[, Y, ...])

augmentation by random rotation and resizing

reshape(data[, channels, chan_first, ...])

reshape data using channels

reshape_and_normalize_data(train_data[, ...])

inputs converted to correct shapes for training and rescaled so that 0.0=1st percentile and 1.0=99th percentile of image intensities in each channel

reshape_train_test(train_data, train_labels, ...)

check sizes and reshape train and test data for training

resize_image(img0[, Ly, Lx, rsz, ...])

resize image for computing flows / unresize for computing dynamics

unaugment_tiles(y[, unet])

reverse test-time augmentations for averaging

update_axis(m_axis, to_squeeze, ndim)