track_greedy

lumicks.pylake.track_greedy

track_greedy(kymograph, channel, *, track_width=None, pixel_threshold=None, window=8, sigma=None, velocity=0.0, diffusion=0.0, sigma_cutoff=2.0, rect=None, bias_correction=True)

Track particles on an image using a greedy algorithm.

A method based on connecting feature points. Detection of the feature points is done analogously to 1, using a greyscale dilation approach to detect peaks, followed by a local centroid computation to achieve subpixel accuracy. After peak detection the feature points are linked together using a greedy forward search analogous to 2. This in contrast with the linking algorithm in 1 which uses a graph based optimization approach.

The linking step traverses the kymograph, tracing tracks starting from each frame. It starts with the highest intensity track and proceeds to tracks with lower signal intensity. For every point along the track, the algorithm makes a prediction for where the particle will be in the next frame. Points are considered candidates for track membership when they fall within a cone parameterized by a sigma and diffusion constant. The candidate point closest to the prediction is chosen and connected to the track. When no more candidates are available the track is terminated.

Note

The track_width parameter is given in physical units, but the algorithm works with discrete pixels. In order to avoid bias in the result, the number of pixels to use is rounded up to the nearest odd value.

Parameters
  • kymograph (Kymo) – The kymograph to track.

  • channel ({'red', 'green', 'blue'}) – Color channel to track.

  • track_width (float or None) –

    Expected (spatial) spot size in physical units. Must be larger than zero. If None, the default is 0.35 (half the wavelength of the red limit of the visible spectrum) for kymographs calibrated in microns. For kymographs calibrated in kilobase pairs the corresponding value is calculated using 0.34 nm/bp (from duplex DNA).

    Note: For tracking purposes, the track width is rounded up to the nearest odd number of pixels; the resulting value must be at least 3 pixels.

  • pixel_threshold (float or None) – Intensity threshold for the pixels. Local maxima above this intensity level will be designated as a track origin. Must be larger than zero. If None, the default is set to the 98th percentile of the image signal.

  • window (int) – Number of kymograph lines in which the particle is allowed to disappear (and still be part of the same track).

  • sigma (float or None) – Uncertainty in the particle position. This parameter will determine whether a peak in the next frame will be linked to this one. Increasing this value will make the algorithm tend to allow more positional variation in the tracks. If none, the algorithm will use half the track width.

  • velocity (float) – Expected velocity of the traces in the image in physical units. This can be used for non-static particles that are expected to move at a constant rate (default: 0.0).

  • diffusion (float) – Expected diffusion constant in physical units (default: 0.0). This parameter will influence whether a peak in the next frame will be connected to this one. Increasing this value will make the algorithm allow more positional variation over time. If a particle disappears for a few frames and then reappears, points before and after the interval where the particle was not visible are more likely to be connected with a higher diffusion setting. Must be equal to or greater than zero.

  • sigma_cutoff (float) – Sets at how many standard deviations from the expected trajectory a particle no longer belongs to this track. Lower values result in tracks being more stringent in terms of continuing (default: 2.0).

  • rect (tuple of two coordinates) – Only perform tracking over a subset of the image. When this argument is supplied, the peak detection and refinement is performed over the full image, but the results are then filtered to omit the peaks that fall outside of the rect. Coordinates should be given as: ((min_time, min_coord), (max_time, max_coord)).

  • bias_correction (bool) – Correct coordinate bias by ensuring that the window is symmetric (see 3 for more information). Note that while this increases the variance (reduces precision), it can greatly reduce the bias when there is a high background.

References

1(1,2)

Sbalzarini, I. F., & Koumoutsakos, P. (2005). Feature point tracking and trajectory analysis for video imaging in cell biology. Journal of structural biology, 151(2), 182-195.

2

Mangeol, P., Prevo, B., & Peterman, E. J. (2016). KymographClear and KymographDirect: two tools for the automated quantitative analysis of molecular and cellular dynamics using kymographs. Molecular biology of the cell, 27(12), 1948-1957.

3

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.