motile_plugin.core
Submodules
Classes
A set of tracks consisting of a graph and an optional segmentation. |
|
Types of nodes in the track graph. Currently used for standardizing |
Package Contents
- class motile_plugin.core.Tracks(/, **data: Any)
Bases:
pydantic.BaseModel
A set of tracks consisting of a graph and an optional segmentation. The graph nodes represent detections and must have a time attribute and position attribute. Edges in the graph represent links across time.
- Attributes:
- graph (nx.DiGraph): A graph with nodes representing detections and
and edges representing links across time. Assumed to be “valid” tracks (e.g., this is not supposed to be a candidate graph), but the structure is not verified.
- segmentation (Optional(np.ndarray)): An optional segmentation that
accompanies the tracking graph. If a segmentation is provided, it is assumed that the graph has an attribute (default “seg_id”) holding the segmentation id. Defaults to None.
- time_attr (str): The attribute in the graph that specifies the time
frame each node is in.
- pos_attr (str | tuple[str] | list[str]): The attribute in the graph
that specifies the position of each node. Can be a single attribute that holds a list, or a list of attribute keys.
- graph: networkx.DiGraph
- segmentation: numpy.ndarray | None = None
- time_attr: str
- pos_attr: str | tuple[str] | list[str]
- scale: list[float] | None = None
- model_config
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- get_location(node: Any, incl_time: bool = False)
Get the location of a node in the graph. Optionally include the time frame as the first dimension. Raises an error if the node is not in the graph.
- Args:
node (Any): The node id in the graph to get the location of. incl_time (bool, optional): If true, include the time as the
first element of the location array. Defaults to False.
- Returns:
- list[float]: A list holding the location. If the position
is stored in a single key, the location could be any number of dimensions.
- get_time(node: Any) int
Get the time frame of a given node. Raises an error if the node is not in the graph.
- Args:
node (Any): The node id to get the time frame for
- Returns:
int: The time frame that the node is in
- get_area(node: Any) int
Get the area/volume of a given node. Raises an error if the node is not in the graph. Returns None if area is not an attribute.
- Args:
node (Any): The node id to get the area/volume for
- Returns:
int: The area/volume of the node