organoid_tracker.core.spline module
- class organoid_tracker.core.spline.Spline
Bases:
object
A curve (curved line) trough the positions. This can be used to measure how far the positions are along this curve.
An offset specifies the zero-point of the axis. A checkpoint (relative to the offset) specifies some point after which a newregion starts. For example, in intestinal organoids this is used to mark the boundary between the crypt and the villus.
- copy() Spline
Returns a copy of this path. Changes to this path will not affect the copy and vice versa.
- from_position_on_axis(path_position: float) Optional[Tuple[float, float, float]]
Given a path position, this returns the corresponding x, y and z coordinates. Returns None for positions outside of the line.
- get_direction_marker() str
Returns a char thar represents the general direction of this path: “>”, “<”, “^” or “v”. The (0,0) coord is assumed to be in the top left.
- get_interpolation_2d() Tuple[List[float], List[float]]
Returns a (cached) list of x and y values that are used for interpolation.
- get_interpolation_3d() Tuple[List[float], List[float], List[float]]
Returns a (cached) list of x, y and z values that are used for interpolation.
- get_offset() float
Gets the offset used in calls to get_path_position_2d and path_position_to_xy. Note that these methods apply the offset automatically, so except for saving/loading purposes there should be no need to call this method.
- get_points_2d() Tuple[List[float], List[float]]
Gets all explicitly added points (no interpolation) without the z coord.
- get_points_3d() Tuple[List[float], List[float], List[float]]
Gets all explicitly added points (no interpolation) including the z coord.
- remove_point(x: float, y: float)
Removes the point that is (within 1 px) at the given coords. Does nothing if there is no such point.
- set_offset(offset: float)
Manually sets the offset used in calls to get_path_position_2d and path_position_to_xy. See also update_offset_for_positions.
- to_position_on_axis(position: Position) Optional[SplinePosition]
Interprets this spline as an axis. Gets the closest position on this axis and the distance to the axis, both in pixels. Returns None if this spline has fewer than 2 points.
- class organoid_tracker.core.spline.SplineCollection
Bases:
object
Holds the paths of all time points in an experiment.
- add_spline(time_point: TimePoint, path: Spline, spline_id: Optional[int]) int
Adds a new spline to the given time point. If another spline with that id already exists in the time point, it is overwritten. If spline_id is None, a new id will be assigned. The spline_id is then returned.
- all_splines() Iterable[Tuple[int, TimePoint, Spline]]
Gets all paths. Note that a single time point can have multiple paths.
- exists(path: Spline, time_point: TimePoint) bool
Returns True if the path exists in this path collection at the given time point, False otherwise.
- first_time_point() Optional[TimePoint]
Gets the first time point that contains data axes, or None if there are no axes stored.
- first_time_point_number() Optional[int]
Gets the first time point that contains data axes, or None if there are no axes stored.
- get_spline(time_point: TimePoint, spline_id: int) Optional[Spline]
Gets the spline with the given id and time point. Returns None if not found.
- last_time_point() Optional[TimePoint]
Gets the last time point (inclusive) that contains data axes, or None if there are no axes stored.
- last_time_point_number() Optional[int]
Gets the last time point (inclusive) that contains data axes, or None if there are no axes stored.
- of_time_point(time_point: TimePoint) Iterable[Tuple[int, Spline]]
Gets the data axes of the time point along with their id, or an empty collection if that time point has no paths defined.
- reference_time_point(number: Optional[TimePoint] = None) Optional[TimePoint]
Gets or sets the reference time point number. The reference time point is used to define the “original” axis on which a point resides. Returns None when getting the time point number if there are no data axes provided.
- remove_spline(time_point: TimePoint, spline_to_remove: Spline)
Removes the given data axis from the given time point. Does nothing if the data axis is not used for the given time point.
- set_marker(axis_id: int, axis_marker: Optional[Marker])
Sets the marker of the specified data axes across all time points. High-level version of set_marker_name. If the marker has the extra data “is_axis”: true, then the spline will be used as an axis.
- set_marker_name(axis_id: int, axis_marker: Optional[str], is_data_axis: bool)
Sets the marker of the specified data axes across all time points
- time_points() Iterable[TimePoint]
Gets all time points with data axes in them, from first to last.
- to_position_on_original_axis(links: Links, position: Position) Optional[SplinePosition]
Gets the position on the axis that was closest in the first time point this position appeared. In this way, every position is assigned to a single axis, and will never switch to another axis during its lifetime.
- to_position_on_spline(position: Position, only_axis=False) Optional[SplinePosition]
- class organoid_tracker.core.spline.SplinePosition(axis: Spline, pos: float, distance: float)
Bases:
object
Records a position projected on a spline: both the spline, its id, the position on the spline and the distance to the spline are recorded.
- calculate_angle(position: Position, resolution: ImageResolution) float
Calculates the angle from this point on the data axis to the given position.