Track
- class celltk.track.Track(output='track', **kwargs)
- Parameters
output (
str
, default:'track'
) –
- bayesian_tracker(mask, config_path='celltk/config/bayes_config.json', update_method='exact')
Wrapper for btrack, a Bayesian-based tracking algorithm.
Note
The underlying tracking algorithm was developed by `Ulicna
and colleagues`_. Please see: https://github.com/quantumjot/BayesianTracker
- Parameters
mask (
Mask
) – Mask with objects to be segmentedconfig_path (
str
, default:'celltk/config/bayes_config.json'
) – Path to configuration file. Must be JSON.update_method (
str
, default:'exact'
) – Method to use when optimizing the solution. Options are ‘exact’ and ‘approximate’. Use approximate if exact is taking too long or utilizing excessive resources.
- Return type
Mask
[int16
]- Returns
Track with objects linked
- detect_cell_division(image, track, mask=None, displacement_thres=15, frame_thres=3, mass_thres=0.25, dist_thres=0.35, dot_thres=-0.7, angle_weight=0.5)
Detects cells that have divided based on location, size, and intensity information. Daughter cells are expected to be approximately half the total intensity of the mother cell, and to have the mother cell roughly in line and between them.
Note
Any Mask passed to this function will have all other division events removed.
- Parameters
image – Image with intensity information.
track – Mask of objects to detect division on.
mask – Mask of objects to detect division on. Note that the objects must already be linked from frame to frame for the algorithm to work.
displacement_thres – Maximum distance allowed from the centroid of a parent cell to the centroid of a daughter cell.
frame_thres – Maximum number of frames from the division event to a daughter cell.
mass_thres – Maximum error for total intensity of a daughter cell relataive to half of the mother cell’s intensity.
dist_thres – Maximum error allowed for location of mother cell relative to location of the daughter cells. Mother cell is expected to be equidistant from the daughter cells.
dot_thres – Maximum value of the normalized dot product between the two vectors from each daughter cell to the mother cell. Essentially a measure of the angle between the daughter cells.
angle_weight – Weight given to angle and distance information when assigning daughter cells. If multiple candidate daughters are found, they are assigned based on intensity information and angle information.
- Returns
Mask with objects linked and cell division marked
- kit_sch_ge_tracker(image, mask, default_roi_size=2, delta_t=3, cut_off_distance=None, allow_cell_division=True, postprocessing_key=None)
Tree-based tracking algorithm. First creates small tracklets within delta_t frames, then finds a globally optimal solution for linking the tracklets to form full tracks. Has built-in cell detection and can also combine objects.
Note
Objects can change in this algorithm, so the output is not guaranteed to have the exact same objects as the input mask.
Note
A current Gurobi license is required to use this algorithm. Personal licenses are free for academics.
Note
The underlying tracking algorithm was developed by Katharina Loffler and colleagues.
- Parameters
image (
Image
) – Image with intensity informationmask (
Mask
) – Mask with objects to be trackeddefault_roi_size (
int
, default:2
) – Size of the region to look for connecting objects. Set relative to the mean size of the objects. i.e. 2 means a search area twice as large as the mean object.delta_t (
int
, default:3
) – Number of frames in each window for forming tracklets.cut_off_distance (
Optional
[Tuple
], default:None
) – Maximum distance between linked objectsallow_cell_division (
bool
, default:True
) – If True, attempt to locate and mark dividing cells.postprocessing_key (
Optional
[str
], default:None
) – TODO. See KIT-Sch-GE documentation
- Return type
Mask
[int16
]
- lineage_masks(track)
Creates a mask where all daughter cells have the label of their parent cell.
- Parameters
track (
Mask
) – Track with parent and daughter cells.- Return type
Mask
[int16
]- Returns
- linear_tracker_w_properties(image, mask, properties=[], weights=None, thresholds=None, displacement_thres=30, mass_thres=0.15)
Tracks objects from frame to frame by optimizing the cost defined by an arbitrary list of properties. By default, includes thresholds on the distance and difference in intensity for two linked objects.
- Parameters
image (
Image
) –mask (
Mask
) –properties (
Collection
[str
], default:[]
) –weights (
Optional
[Collection
[float
]], default:None
) –thresholds (
Optional
[Collection
[float
]], default:None
) –displacement_thres (
float
, default:30
) –mass_thres (
float
, default:0.15
) –
- Return type
Mask
[int16
]
- simple_linear_tracker(mask, voronoi_split=True)
Tracks objects by optimizing the area overlap from frame to frame.
- Parameters
mask (
Mask
) – Mask with the objects to be tracked uniquely labeled.voronoi_split (
bool
, default:True
) – If True, creates a voronoi map from the objects in mask. Uses that map to keep objects separated in each frame. Slows down computation.
- Return type
Mask
[int16
]- Returns
Mask with objects linked
- simple_watershed_tracker(mask, connectivity=2, watershed_line=True, keep_seeds=False)
Uses watershed to track from objects in one frame to objects in the next. Useful for objects that grow in size, but don’t move much, such as bacterial colonies.
- Parameters
mask (
Mask
) – Mask with the objects to be tracked uniquely labeled.connectivity (
int
, default:2
) – Determines the local neighborhood around a pixel. Defined as the number of orthogonal steps needed to reach a pixel.watershed_line (
bool
, default:True
) – If True, a one-pixel wide line separates the regions obtained by the watershed algorithm. The line is labeled 0.keep_seeds (
bool
, default:False
) – If True, seeds from previous frame are always kept. This is more robust for segmentation that is incomplete or fragmented in some frames. However, the mask will be monotonically increasing in size. Not appropriate for images with drift or for moving objects.
- Return type
Mask
[int16
]- Returns
Mask with objects linked