organoid_tracker.core.position_collection module
- class organoid_tracker.core.position_collection.PositionCollection(positions: Iterable[Position] = ())
Bases:
object
- add(position: Position)
Adds a position, optionally with the given shape. The position must have a time point specified.
- add_positions(other: PositionCollection)
Adds all positions and shapes of the other collection to this collection.
- contains_position(position: Position) bool
Returns whether the given position is part of the experiment.
- copy() PositionCollection
Creates a copy of this positions collection. Changes made to the copy will not affect this instance and vice versa.
- count_positions(*, time_point: Optional[TimePoint], z: Optional[int])
Counts the number of positions at the given time point and the given z. If no z or time point is given, positions at all time points and/or all z will be counted.
- detach_all_for_time_point(time_point: TimePoint)
Removes all positions for a given time point, if any.
- detach_position(position: Position)
Removes a position from a time point. Does nothing if the position is not in this collection.
- first_time_point() Optional[TimePoint]
Gets the first time point that contains positions, or None if there are no positions stored.
- first_time_point_number() Optional[int]
Gets the first time point that contains positions, or None if there are no positions stored.
- highest_z() Optional[int]
Returns the lowest z in use, or None if there are no positions in this collection.
- last_time_point() Optional[TimePoint]
Gets the last time point (inclusive) that contains positions, or None if there are no positions stored.
- last_time_point_number() Optional[int]
Gets the last time point (inclusive) that contains positions, or None if there are no positions stored.
- lowest_z() Optional[int]
Returns the lowest z in use, or None if there are no positions in this collection.
- move_position(old_position: Position, new_position: Position)
Moves a position, keeping its shape. Does nothing if the position is not in this collection. Raises a value error if the time points the provided positions are None or if they do not match.
- nearby_z(z: int) Iterable[Position]
Returns all positions (for any time point) for which round(position.z) == z.
- of_time_point(time_point: TimePoint) AbstractSet[Position]
Returns all positions for a given time point. Returns an empty set if that time point doesn’t exist.