organoid_tracker.linking.nearest_neighbor_linker module

Ultra-simple linker. Used as a starting point for more complex links.

class organoid_tracker.linking.nearest_neighbor_linker.LogisticFit(popt: tuple[float, float])

Bases: object

Result of the fit of the sigmoid function to the link-is-correct probability per distance data.

k: float
x0: float
organoid_tracker.linking.nearest_neighbor_linker.nearest_neighbor(experiment: Experiment, *, tolerance: float = 1.0, back: bool = True, forward: bool = True, max_distance_um: float = inf) Links

Simple nearest neighbour linking, keeping a list of potential candidates based on a given tolerance.

A tolerance of 1.05 also links positions 5% from the closest position, so you end up with more links than you have positions.

If the experiment has images loaded, then no links outside the images will be created.

Nearest neighbor-linking can happen both forwards (every position is linked to the nearest in the next time point) and backwards (every position is linked to the nearest in the previous time point). If you do both, note that the tolerance is calculated independently for both directions: with a tolerance of for example 2, you’ll get all forward links that are at most twice as long as the shortest forward link, and you’ll get all backward links that are at most twice as long as the shortest backward link.

organoid_tracker.linking.nearest_neighbor_linker.nearest_neighbor_probabilities(experiment: Experiment, *, tolerance: float = 2.0, max_distance_um: float = 50, distance_bin_size_um_log: float = 0.25) Tuple[Links, LogisticFit]

First does nearest-neighbor linking, and assumes all nearest links to be true, the rest false. Creates a probability map of distance –> assumed correct. Then sets probabilities based on that.

Default tolerance is 2.0, which means that all links that are at most twice as long as the nearest link are also taken into account as potential links.