baby.tracker.core.MasterTracker¶
- class baby.tracker.core.MasterTracker(ctrack_args=None, btrack_args=None, min_bud_tps=3, isbud_thresh=0.5, **kwargs)¶
Bases:
FeatureCalculator
Coordinates the data transmission from CellTracker to BudTracker to reduce number of calls to regionprops function.
input :ctrack_args: dict with arguments to pass on to CellTracker constructor
if None it passes all the features to use
- Btrack_args
dict with arguments to pass on to BudTracker constructor if None it passes all the features to use
- **kwargskwargs
additional arguments passed to FeatureCalculator constructor
- 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_trapfeats
(basefeats)Calculate trap-based features using basic ones. :basefeats: (n basic outfeats) 1-D array with features outputed by skimage.measure.regionprops_table.
scale_feats
(feats, pixel_size)input
step_trackers
(masks, p_budneck, p_bud[, ...])Calculate features and track cells and budassignments
get_outfeats
load_model
set_named_ids
- __init__(ctrack_args=None, btrack_args=None, min_bud_tps=3, isbud_thresh=0.5, **kwargs)¶
Methods
__init__
([ctrack_args, btrack_args, ...])calc_feats_from_mask
(masks[, feats2use, ...])Calculate feature ndarray from ndarray of cell 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])load_model
(path, fname)scale_feats
(feats, pixel_size)input
set_named_ids
()step_trackers
(masks, p_budneck, p_bud[, ...])Calculate features and track cells and budassignments
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_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
- 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
- step_trackers(masks, p_budneck, p_bud, state=None, assign_mothers=False, return_baprobs=False, keep_full_state=False)¶
Calculate features and track cells and budassignments
input
- Masks
3d ndarray (ncells, size_x, size_y) containing cell masks
- 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
- State
running state for the tracker, or None for initialisation
- Assign_mothers
whether to include mother assignments in the returned returns
- Return_baprobs
whether to include bud assignment probability matrix in the returned output
returns a dict consisting of
- Cell_label
list of int, the tracked global ID for each cell mask
- State
the updated state to be used in a subsequent step
- Mother_assign
(optional) list of int, specifying the assigned mother for each cell
- P_bud_assign
(optional) matrix (list of lists of floats), bud assignment probability matrix from predict_mother_bud