track_lines

lumicks.pylake.track_lines

track_lines(kymograph, channel, line_width, max_lines, *, start_threshold=0.005, continuation_threshold=0.005, angle_weight=10.0, rect=None)

Track particles on an image using an algorithm that looks for line-like structures.

This function tracks particles in an image. It takes a pixel image, and traces lines on it. These lines are subsequently refined and/or used to extract intensities or other parameters. Refinement is performed using a bias-corrected centroid optimization according to 2.

This method is based on sections 1, 2 and 3 from 1. This method attempts to find lines purely based on differential geometric considerations. It blurs the image based with a user specified line width and then attempts to find curvilinear sections. Based on eigenvalue decomposition of the local Hessian it finds the principal direction of the line. It then computes subpixel accurate positions by computing the maximum perpendicular to the line using local Taylor expansions. Pixels where this subpixel position estimate falls within the pixel are considered lines. The initial step leads to lines with a width of one. These lines are then traced. When ambiguity arises, on which point to connect next, a score comprised of the distance to the next subpixel minimum and angle between the successive normal vectors is computed. The candidate with the lowest score is then selected.

For more information, please refer to the paper.

Parameters
  • kymograph (Kymo) – Kymograph.

  • channel (str) – Kymograph channel.

  • line_width (float) – Expected line width in physical units. Must be larger than zero.

  • max_lines (int) – Maximum number of lines to trace.

  • start_threshold (float) – Threshold for the value of the derivative.

  • continuation_threshold (float) – Derivative threshold for the continuation of a line.

  • angle_weight (float) – Factor which determines how the angle between normals needs to be weighted relative to distance. High values push for straighter lines. Weighting occurs according to distance + angle_weight * angle difference

  • rect (tuple of two coordinates) – Only perform tracking over a subset of the image. Coordinates should be given as: ((min_time, min_coord), (max_time, max_coord)).

Returns

kymotrack_group

Return type

KymoTrackGroup

Raises

ValueError – If the line_width is not larger than 3 pixels if refinement is selected.

References

1

Steger, C. (1998). An unbiased detector of curvilinear structures. IEEE Transactions on pattern analysis and machine intelligence, 20(2), 113-125.

2

Berglund, A. J., McMahon, M. D., McClelland, J. J., & Liddle, J. A. (2008). Fast, bias-free algorithm for tracking single particles with variable size and shape. Optics express, 16(18), 14064-14075.