update_segmentation

btrack.utils.update_segmentation(segmentation: npt.NDArray, tracks: list[btypes.Tracklet], *, scale: Optional[tuple(float)] = None, color_by: str = 'ID') npt.NDArray

Map tracks back into a masked array.

Parameters:
segmentationnpt.NDArray

Array containing a timeseries of single cell masks. Dimensions should be ordered T(Z)YX. Assumes that this is not binary and each object has a unique ID.

trackslist[btypes.Tracklet]

A list of btrack.btypes.Tracklet objects from BayesianTracker.

scaletuple, optional

A scale for each spatial dimension of the input tracks. Defaults to one for all axes, and allows scaling for anisotropic imaging data. Dimensions should be ordered XY(Z).

color_bystr, default = β€œID”

A value to recolor the segmentation by.

Returns:
relabelednpt.NDArray

Array containing the same masks as segmentation but relabeled to maintain single cell identity over time.

Notes

Useful for recoloring a segmentation by a property such as track ID or root tree node. Currently the property must be an integer value, greater than zero.