organoid_tracker.gui.location_map module

class organoid_tracker.gui.location_map.LocationMap(*, cell_size_x: float = 1, cell_size_y: float = 1)

Bases: object

A map of (x,y) to an object. Cannot store values for negative x and y. Stores everything in a continuous array

in memory, so if you store values at large (x,y) this object will consume a lot of memory. You can set a large

cell size to combat this effect.

find_object(obj: object) Tuple[Optional[float], Optional[float]]

Finds back the given object in the location map. If it occurs multiple times in the location map, then this method returns an arbitrary location. If the object doesn’t occur in the map, then this method returns (None, None).

get_nearby(around_x: float, around_y: float) Optional[object]

Gets the value at the given x and y position, searching for at most 2 indices next to it until a value that isn’t None is returned.

set(x: float, y: float, value: Optional[object])

Sets the value in the grid to be equal to the given object.

set_area(min_x: float, min_y: float, max_x: float, max_y: float, value: Optional[object])

Sets the values in the given area of the grid all equal to the given value.