# Tracking cells as they move under a microscope

I have a video (tiff file) of cells under a microscope and I'd like to segment and track the location and sizes of them across time:

It has a hundred frames:

I've uploaded it here (now it is public):

frames = CloudGet @ "https://www.wolframcloud.com/obj/3b3ecc16-c9e8-4b2d-a824-35e8ea1307a7"

There are many great answers on how to segment cells and objects, but not to track them (probably because mma doesn't fully support videos yet).

There are three steps and I've stuck on all of them:

1. Experiment for hyperparameters (AdaptiveBinarize, RingeFilter...)
2. Find center-points / segmentations (MaxDetect, SelectComponents...)
3. Track into next frame while adding/removing in-out of frame cells (ImageCorrepondingPoint, ImageFeatureTrack...)

How far I've gotten:

The first step is to find thresholding parameters for preprocessing and finding the cell loci (bright points). I always forget which is the best preprocessing combo to use...

i1 = frames[[1]]; i2 = frames[[2]];
Manipulate[
, {o, .1, 10, 1}]

Then the segmentation

Manipulate[
segments =
"Area", a1 < # < a2 &]; Colorize[segments]
, {gf, 0.1, 2}, {a1, 1, 1000}, {a2, 1, 1000}]

But I get into cases like this:

Manipulate[
b = Binarize[i, {0.7, 1}];
segments =
SelectComponents[
b, (0 < #Area < 1000 && #Count >
circles =
ComponentMeasurements[
Show[HighlightImage[i, {Blue, markers}],
Graphics[{Red, Thick, Circle @@ # & /@ circles[[All, 2]]}]], {w, 1,
5}, {c, 0, 100}, SynchronousUpdating -> False
]

References:

This was the only post I've found that addressed moving cells:

• I think you didn't use Permission -> "Public" when CloudDeploying your frames. – Chip Hurst Sep 3 at 19:29
• @ChipHurst Thanks for that update, fixed! – M.R. Sep 3 at 20:14
• Might be a relevant python based example: soft-matter.github.io/trackpy/v0.3.0/tutorial/walkthrough.html. We can use the python integration available in MMA to tinker with this examples. – PlatoManiac Sep 3 at 23:10
• Nothing new is in my answer to this question but it pertains to image tracking and might be useful to include as a resource. – bobthechemist Sep 4 at 1:34
• am not able to get the object from wolframcloud. I always got Null object. Do you know why? – Qiang Li Sep 4 at 4:25

You may use ImageFeatureTrack.

frames as in OP, then

tracks = Transpose@
ImageFeatureTrack[frames,
MaxFeatures -> 200,
MaxFeatureDisplacement -> 1,
Tolerance -> 0.001];

There were 178 tracks found.

Dimensions@tracks
{178, 100}

However, not all tracks have values across all 100 frames.

FreeQ[Missing]@tracks
False

Starting locations are

HighlightImage[frames[[1]], {Blue, tracks[[All, 1]]}]

Tracks are plotted by

ListLinePlot[tracks,
AspectRatio -> 1,
PlotRange -> All]

Hope this helps.