wormpose.pose.centerline

This module contains function related to the worm centerline, for example to convert skeleton (x, y) coordinates to angles, flip the head-tail orientation etc

wormpose.pose.centerline.calculate_skeleton(theta: numpy.ndarray, worm_length: float, canvas_width_height: Tuple[int, int] = (0, 0), out: Optional[numpy.ndarray] = None) numpy.ndarray[source]

Calculates (x,y) coordinates of the worm centerline from the tangent angle (theta) vector

Parameters
  • theta – centerline angles

  • worm_length – desired worm length

  • out – optional numpy array of shape (len(theta), 2) to store the resulting skeleton

  • canvas_width_height – optional canvas to recenter the skeleton coordinates in the middle

Returns

output skeleton: numpy array of shape (len(theta), 2) representing the centerline angles

wormpose.pose.centerline.flip_theta(theta: numpy.ndarray) numpy.ndarray[source]

head-tail flip for one value

wormpose.pose.centerline.flip_theta_series(theta_series: numpy.ndarray) numpy.ndarray[source]

head-tail flip for each value in a serie

wormpose.pose.centerline.interpolate_skeleton(skeleton: numpy.ndarray, new_dims: int) numpy.ndarray[source]

Interpolates a worm skeleton to have a different number of points