organoid_tracker.linking.nearby_position_finder module
Contains function that allows you to find the nearest few positions
- organoid_tracker.linking.nearby_position_finder.find_close_positions(positions: Iterable[Position], *, around: Position, tolerance: float, resolution: ImageResolution, max_amount: int = 1000, max_distance_um: float = inf) List[Position]
Finds the positions nearest to the given position.
search_in is the time_point to search in
around is the position to search around
tolerance is a number that influences how much positions other than the nearest are included. A tolerance of 1.05 makes positions that are 5% further than the nearest also included.
max_amount if the maximum amount of returned positions. If there are more positions within the tolerance, then only the nearest positions are returned.
Returns a list of the nearest positions, ordered from closest to furthest
- organoid_tracker.linking.nearby_position_finder.find_closest_n_positions(positions: Iterable[Position], *, around: Position, max_amount: int, resolution: ImageResolution, max_distance_um: float = 100000, ignore_self: bool = True) Set[Position]
- organoid_tracker.linking.nearby_position_finder.find_closest_position(positions: Iterable[Position], *, around: Position, resolution: ImageResolution, ignore_z: bool = False, max_distance_um: int = 100000) Optional[Position]
Gets the position closest ot the given position.
- organoid_tracker.linking.nearby_position_finder.make_nearby_positions_graph(resolution: ImageResolution, positions: List[Position], *, neighbors: int) Graph
Creates a networkx.Graph of Position objects, where each object is connected to its N nearest neighbors. The edges all have the “distance_um” attribute, which is hte distance between those positions in micrometers.
Example of how to iterate over the resulting object: >>> for position_a, position_b, distance_um in graph.edges.data(“distance_um”): >>> … # Do something with the positions and the distance between them