baby.tracker.core.BudTracker

class baby.tracker.core.BudTracker(model=None, feats2use=None, **kwargs)

Bases: FeatureCalculator

Attributes
a_ind
ma_ind
x_ind
y_ind

Methods

calc_feats_from_mask(masks[, feats2use, ...])

Calculate feature ndarray from ndarray of cell masks

calc_mother_bud_stats(p_budneck, p_bud, masks)

---

calc_trapfeats(basefeats)

Calculate trap-based features using basic ones. :basefeats: (n basic outfeats) 1-D array with features outputed by skimage.measure.regionprops_table.

get_rpoints(feats, d, m)

Draw a rectangle in the budneck of cells

predict_mother_bud(p_budneck, p_bud, masks)

---

scale_feats(feats, pixel_size)

input

get_outfeats

load_model

set_named_ids

__init__(model=None, feats2use=None, **kwargs)

Methods

__init__([model, feats2use])

calc_feats_from_mask(masks[, feats2use, ...])

Calculate feature ndarray from ndarray of cell masks

calc_mother_bud_stats(p_budneck, p_bud, masks)

---

calc_trapfeats(basefeats)

Calculate trap-based features using basic ones. :basefeats: (n basic outfeats) 1-D array with features outputed by skimage.measure.regionprops_table.

get_outfeats([feats2use])

get_rpoints(feats, d, m)

Draw a rectangle in the budneck of cells

load_model(path, fname)

predict_mother_bud(p_budneck, p_bud, masks)

---

scale_feats(feats, pixel_size)

input

set_named_ids()

Attributes

a_ind

ma_ind

x_ind

y_ind

calc_feats_from_mask(masks: ndarray, feats2use: Optional[Tuple[str]] = None, trapfeats: Optional[Tuple[str]] = None, scale: Optional[bool] = True, pixel_size: Optional[float] = None)

Calculate feature ndarray from ndarray of cell masks — input

Masks

ndarray (ncells, x_size, y_size), typically dtype bool

Feats2use

list of strings with the feature properties to extract. If it is None it uses the ones set in self.feats2use.

Trapfeats

List of str with additional features to use calculated immediately after basic features.

Scale

bool, if True scales mask to a defined pixel_size.

Pixel_size

float, used to rescale the object features.

returns

(ncells, nfeats) ndarray of features for input masks

calc_mother_bud_stats(p_budneck, p_bud, masks, feats=None)

input

P_budneck

2d ndarray (size_x, size_y) giving the probability that a pixel corresponds to a bud neck

P_bud

2d ndarray (size_x, size_y) giving the probability that a pixel corresponds to a bud

Masks

3d ndarray (ncells, size_x, size_y)

Feats

ndarray (ncells, nfeats)

NB: ASSUMES FEATS HAVE ALREADY BEEN NORMALISED!

returns

N2darray

2d ndarray (ncells x ncells, n_feats) specifying, for each pair of cells in the masks array, the features used for mother-bud pair prediction (as per ‘feats2use’)

calc_trapfeats(basefeats)

Calculate trap-based features using basic ones. :basefeats: (n basic outfeats) 1-D array with features outputed by

skimage.measure.regionprops_table

requires

self.aind self.aweights self.xind self.yind self.trapfeats

returns (ntrapfeats) 1-D array with

get_rpoints(feats, d, m)

Draw a rectangle in the budneck of cells —

NB: ASSUMES FEATS HAVE ALREADY BEEN NORMALISED!

input

feats: 2d ndarray (ncells, nfeats)

returns

r_points: 2d ndarray (2,4) with the coordinates of the rectangle corner

predict_mother_bud(p_budneck, p_bud, masks, feats=None)

input

P_budneck

2d ndarray (size_x, size_y) giving the probability that a pixel corresponds to a bud neck

P_bud

2d ndarray (size_x, size_y) giving the probability that a pixel corresponds to a bud

Masks

3d ndarray (ncells, size_x, size_y)

Feats

ndarray (ncells, nfeats)

returns

N2darray

2d ndarray (ncells, ncells) giving probability that a cell (row) is a mother to another cell (column)

scale_feats(feats: ndarray, pixel_size: float)

input

Feats

np.ndarray (ncells * nfeatures)

Pixel_size

float Value used to normalise the images.

returns Rescaled list of feature values