Beth Cimini, Broad Institute
Tracking is, in the words of Florian Jug, "image analysis' most solve problem" - because it is exceedingly hard to solve.
Tracking is especially hard because it is an exponential problem - as your tracks get longer, even tiny errors in segmentation and linking can destroy the accuracy of your tracking.
One option is to simply not do tracking at all but instead use a proxy metric - see this notebook where instead of using tracking to calculate doubling times, simple thresholding is used instead (to great effect).
Sometimes, though, your biological question does require you to track. We will demonstrate a popular tracking workflow that uses Cellpose (a very popular deep learning based segmentation software) and Trackmate (probably the most popular tracking tool).
We will use data from the CellTracking challenge collection - download and unzip this folder of hepatocarcinoma cell images.
-
Install GUI-enabled Cellpose from these instructions . The images in this tutorial use Cellpose 2, which you can install with
pip install cellpose[gui]<3
. You may omit the pin though to use Cellpose 3. -
Open Cellpose from the command line with the command
cellpose
- On the course VMs, you can do this by opening GitBash, typing
micromamba activate cellpose
, thencellpose
- On the course VMs, you can do this by opening GitBash, typing
-
Drag in a cell from the
01
folder and try a couple of models.- How does changing the cell diameter affect the segmentation? The flow_threshold? Cellprob_threshold?
- You can use the left and right arrows to scroll to different timepoints of the movie.
-
To gain a bit more insight into how the parameters change the outputs, try looking at the flows and probability views
-
Install Trackmate by enabling its update site in Fiji. Close and reopen Fiji.
-
Run
File -> Import -> ImageSequence
, and import movie01
-
Run
Plugins -> Tracking -> Trackmate
to open Trackmate -
Choose the Cellpose detector option
-
Point it at your installation of Cellpose, and use the Cytoplasm 2.0 model
- If you aren't sure where your Cellpose is installed, return to the terminal where you launched it and type
which python
- If you aren't sure where your Cellpose is installed, return to the terminal where you launched it and type
-
Let Cellpose run - without a GPU, this takes ~5 minutes
-
Skip the next step ("Initial Thresholding"), since it removes spots that would need to re-run Cellpose if you wanted back. Besides, we don't want to remove things we haven't looked at!
-
Hit the plus button to add a filter and coloring options that will allow you to examine your cells by area, intensity, color, etc. Set any filters you think you may want.
-
Pick a tracker.
LAP
is a good common-use tracker but requires a lot of parameter tuning, so here we recommend Overlap, which is simpler. -
Set any hyperparameters your tracking method requires.
-
Filter your tracks by the number of spots, if you're confident how many is a good minimum (or just wait until the next window).
-
Congratulations, you've now finished tracking! Just like before, you can now add colors to the tracks themselves so you can filter them intelligently in various ways. From this window, you can also export quantitative data.
-
You can also launch the TrackScheme, which will allow you to see where all your tracks start and stop (and uses the coloring from the other window. Click on on spot to highlight that cell.)
-
If desired, Trackmate gives you a lot of other options, including creating graphs, exporting to Icy, etc. Read the manual to learn more!
- Try this now with movie
02
- it's much harder. How does it perform? How much more filtering do you need to do? What if you try a different tracking method like LAP? - Try training a custom Cellpose model on movie 02 following the training instructions in the GUI. Does it improve your ability to do tracking? Does it improve it enough?
- What if you only tried tracking the nuclei (by picking or training a Cellpose model that does that)? How well does this work on the segementation level, and the tracking level?