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:
- Experiment for hyperparameters (AdaptiveBinarize, RingeFilter...)
- Find center-points / segmentations (MaxDetect, SelectComponents...)
- 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...
frames = ImageAdjust /@ frames;
i1 = frames[[1]]; i2 = frames[[2]];
Manipulate[
HighlightImage[i1, MaxDetect@ImageAdjust@RidgeFilter[i1, o]]
, {o, .1, 10, 1}]
Then the segmentation
Manipulate[
segments =
SelectComponents[WatershedComponents[GradientFilter[i2, gf], pts],
"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}];
markers = MaxDetect@ImageAdjust@RidgeFilter[i1, w];
segments =
SelectComponents[
b, (0 < #Area < 1000 && #Count >
c(*&& #AdjacentBorderCount\[Equal]0*)) &];
circles =
ComponentMeasurements[
segments, {"Centroid", "EquivalentDiskRadius"}];
Show[HighlightImage[i, {Blue, markers}],
Graphics[{Red, Thick, Circle @@ # & /@ circles[[All, 2]]}]], {w, 1,
5}, {c, 0, 100}, SynchronousUpdating -> False
]
Help on canonicalizing this answer would cure many headaches :)
References:
- Segmentation of a microscopy image with uneven illumination
- what scheme to use to segment this aggregate of cells in such a poor illumination
This was the only post I've found that addressed moving cells:
Permission -> "Public"
whenCloudDeploying
your frames. $\endgroup$