structural
sleap.qc.features.structural
¶
Structural features: curvature, convex hull.
Functions:
| Name | Description |
|---|---|
compute_convex_hull |
Compute convex hull metrics for pose compactness. |
compute_curvature |
Compute curvature along a chain of nodes (e.g., spine). |
compute_convex_hull(points)
¶
Compute convex hull metrics for pose compactness.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
ndarray
|
(N, 2) array of node coordinates (NaN for invisible). |
required |
Returns:
| Type | Description |
|---|---|
dict[str, float]
|
Dictionary with: - hull_area: area of convex hull - hull_perimeter: perimeter of convex hull - hull_aspect_ratio: width/height of hull bounding box - compactness: 4*pi*area / perimeter^2 (1 = circle) - n_hull_points: number of points on hull |
Source code in sleap/qc/features/structural.py
compute_curvature(points, chain)
¶
Compute curvature along a chain of nodes (e.g., spine).
Curvature at each interior node is computed from the angle formed by adjacent edges. High curvature = sharp bend.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
ndarray
|
(N, 2) array of node coordinates. |
required |
chain
|
list[int]
|
Ordered list of node indices forming a chain. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, float]
|
Dictionary with: - curvatures: array of curvature values at each interior node - max_curvature: maximum absolute curvature - mean_curvature: mean absolute curvature - curvature_std: standard deviation of curvature - sign_changes: number of curvature sign changes (wiggliness) |