Skip to content

Measure Track Motion

Measure Track Motion measures how each track of a tracking step moved: its path and displacement, how far it got from its start, the speeds and ratios of computer-assisted sperm analysis (CASA: VCL, VSL, VAP, LIN, STR, WOB, ALH, BCF) as the WHO laboratory manual (2021) defines them, its turning angle and its mean squared displacement (MSD: α and D). Use it to tell directed from random or confined motion, straight swimmers from circling ones, or to compare the speed of tracks between wells.

A track's positions (dots) and its average path (dashed): the path length L follows every step, the displacement d goes from the first to the last position, and the turning angle is between one step and the next

In a project file it is MEASURE_TRACK_MOTION.

It is a dataset step: it runs once after every image has been analysed, on the stored objects of all frames. Add it after the tracking step whose tracks it measures - Track LAP, Track Kalman, Track Overlap or Track Nearest Neighbor:

Track LAP (or another tracker) → Measure Track Motion

The values are stored per track. Results › Tracks shows them as columns - the speed and straightness of a track are its VCL and LIN, so without this step they stay empty - together with each track’s path from its start and its MSD over the lag. Results › Paths draws all tracks from their start and plots LIN against the turning angle or MSD α.

ParameterDescription
IDThe step’s ID, unique in the project. Its values’ names in the results start with it (e.g. motion_01).
ObjectsThe tracked objects measured. A tracking step for this class must come before.
Min StepSteps shorter than this are joined with the next ones before the turning angle is taken - jitter of the centre isn’t turning. The path and the speeds use every step. Default 1, range 0-100000.
UnitUnit of Min Step: px (default) or nm.
Average OverThe average path (for VAP, STR, WOB, ALH, BCF): each position is the mean of the positions this many before and after it. Default 2, range 0-100.
Drift ReferenceObjects that don’t move by themselves (e.g. immotile cells, beads), tracked too: their median step is the image’s drift and is taken away first - see Drift correction. Unset (default): no drift correction.

Without Objects the step stops with an error: Measure Track Motion: choose the tracked objects. Min Step in nm needs the pixel size of the image; without it the step stops with an error.

Sixteen values per track, in pixels and time points (frames):

MeasurementUnitDescription
Path lengthpxThe sum of all steps, LL.
DisplacementpxFrom the first to the last position, dd.
Max distance from startpxThe farthest any position is from the first.
VCL (curvilinear speed)px/framePath length over time, L/TL / T.
VSL (straight-line speed)px/frameDisplacement over time, d/Td / T.
VAP (average path speed)px/frameLength of the average path over time.
LIN (linearity)-VSL / VCL: 1 a straight line, near 0 wandering (0-1).
STR (straightness)-VSL / VAP.
WOB (wobble)-VAP / VCL.
ALH (lateral head amplitude)pxTwice the mean distance of a position from its average path position.
BCF (beat-cross frequency)1/frameHow often the track crosses its average path, per time point.
Turning angle (mean)degreesThe mean angle from one step to the next, + counter-clockwise on the image (-180 to 180).
Turning angle (mean absolute)degreesThe mean of the angles’ absolute values (0-180).
Angular speeddegrees/frameThe summed turning angles over time.
MSD alpha-The exponent α\alpha of the MSD: a random walk gives about 1, a straight line 2, a track that stays in a bounded area less than 1.
MSD Dpx²/frameThe coefficient DD of the MSD.

With a Drift Reference, two more values per image and time point: Drift X and Drift Y (px), how far the image moved since the first time point.

The results can show the lengths, speeds and rates in µm and per minute or second instead - see Results › Tracks.

A value a track can’t have is left out: a track with one time point has only its path length, displacement and max distance (all 0); the MSD needs a long enough track (see MSD). Running the analysis again replaces the step’s values.

The step works image by image and per Z-plane. A track’s position at a time point is the centre of its object’s bounding box; if a track has two objects at one time point, the first counts.

With the positions p1,…,pNp_1, \dots, p_N of a track at the time points t1<⋯<tNt_1 < \dots < t_N and T=tN−t1T = t_N - t_1:

L=∑i=1N−1∣pi+1−pi∣d=∣pN−p1∣VCL=LTVSL=dTL = \sum_{i=1}^{N-1} |p_{i+1} - p_i| \qquad d = |p_N - p_1| \qquad \text{VCL} = \frac{L}{T} \qquad \text{VSL} = \frac{d}{T}

A gap - time points without the object - is one straight step, and its time counts in TT.

Each position of the average path is the mean of the positions up to ww = Average Over before and after it, as many on both sides:

pˉi=12h+1∑j=i−hi+hpjh=min⁡(w, i−1, N−i)\bar{p}_i = \frac{1}{2h+1} \sum_{j=i-h}^{i+h} p_j \qquad h = \min(w,\ i-1,\ N-i)

So near the ends fewer positions are averaged, and the first and last position stay where they are. VAP is the length of the average path over TT, and

LIN=VSLVCLSTR=VSLVAPWOB=VAPVCLALH=2N∑i=1N∣pi−pˉi∣\text{LIN} = \frac{\text{VSL}}{\text{VCL}} \qquad \text{STR} = \frac{\text{VSL}}{\text{VAP}} \qquad \text{WOB} = \frac{\text{VAP}}{\text{VCL}} \qquad \text{ALH} = \frac{2}{N} \sum_{i=1}^{N} |p_i - \bar{p}_i|

A ratio whose divisor is 0 is left out. For BCF, each position lies on one side of the average path’s direction there (from pˉi\bar{p}_i to pˉi+1\bar{p}_{i+1}; at the last position the step before). Every change of side is a crossing; positions on the average path, or where it doesn’t move, are skipped. BCF is the number of crossings over TT.

The steps are taken from position to position, but a step shorter than Min Step (or of length 0) is joined with the next ones until it is long enough. The turning angle is between each step a⃗\vec{a} and the next b⃗\vec{b}:

θ=−atan2⁡(axby−aybx, a⃗⋅b⃗)\theta = -\operatorname{atan2}(a_x b_y - a_y b_x,\ \vec{a} \cdot \vec{b})

in degrees, positive for a turn counter-clockwise as seen on the image (y points down). Turning angle (mean) is the mean of θ\theta - near 0 for random turns, one sign for a track circling one way -, Turning angle (mean absolute) the mean of ∣θ∣|\theta|, and Angular speed ∑θ/T\sum \theta / T. A track needs at least two steps for an angle.

MSD(n)\text{MSD}(n) is the mean squared distance between the positions nn time points apart, over all pairs where the track has both positions. The lags nn go up to T/4T/4, spaced evenly on a log scale - 1, then each 1.25 times the one before, rounded: 1, 2, 3, 4, 5, 6, 7, 9, 12, … - so the noisy long lags of a long track don’t outnumber the short ones. Lags without a pair or with an MSD of 0 are left out.

A straight line is fitted by least squares through ln⁡MSD(n)\ln \text{MSD}(n) over ln⁡n\ln n, with slope α\alpha and intercept bb:

MSD(n)=4D nαD=eb4\text{MSD}(n) = 4 D\, n^{\alpha} \qquad D = \frac{e^{b}}{4}

The fit needs at least 10 positions, T/4≥2T/4 \ge 2 and at least 2 lags; otherwise the track has no MSD alpha and MSD D.

With a Drift Reference, the tracks of that class (in the same image and Z-plane) give the drift of the image - stage movement or flow. For each time point, the drift step is the median of the reference tracks’ steps from the time point before, separately in x and y; only steps of one time point count. Summed up from the first time point, this is the drift, which is subtracted from every position of the measured tracks before anything is measured. Before the references’ first time point the drift is 0, after their last it stays at its last value. A time point without a reference step adds nothing.

  • World Health Organization, WHO laboratory manual for the examination and processing of human semen, sixth edition, Geneva, 2021.
  • All values are in pixels and time points, measured in 2D within one Z-plane.
  • Positions are the centres of the objects’ bounding boxes.
  • The drift reference class has to be tracked too (by its own tracking step before this one).
  • Only project classes can be measured, not the internal classes of a module.