TrackMate v7: Using and integrating DL & ML segmentation algorithms.
This release is the first one of the version 7 series of TrackMate. It includes major changes, that affects TrackMate capabilities, changes in the UI, the data model, and API. It follows an almost complete rewrite of TrackMate, that started with the first covid-19 induced lockdown.
We list here the major changes that affect users and developers that depend on TrackMate for their projects.
Usage and capabilities improvements.
Object contours in 2D.
TrackMate can now store, display, save, load and exploit object contours in 2D.
- The object contours are displayed in the main view,
- they are saved and loaded from the TrackMate XML file,
- they are used to compute spot numerical features such as intensity and shape descriptor (see below).
This new spot contour feature is fully compatible with the existing spot representation. A detector that does not return an object contour will generate spots as the same way as before (small circle or sphere of a fixed radius), and will be treated as before.
Limitations:
- Object contours are only supported for 2D images.
- An object contour has to be a simple polygon. That is: a unique polygon without hole or self-intersection. Holes and objects that are split over disconnected regions are not supported.
- There is yet not a tool to edit the polygon of a spot.
New builtin detectors that generate object contours.
Now that we can store object contours, we need detectors that can generate such contours. There 3 new builtin detectors in TrackMate that implement classic segmentation approaches:
The mask detector.
The mask detector creates objects from a black and white channel in the source image. You can add the mask as an extra channel in the source image. The objects will be built based on all the pixels have a value strictly larger than 0, which solves the issue of having a mask on 8-bit, 16-bit or 32-bit images.
It is documented here.
The threshold detector.
The threshold detector creates objects from a grayscale image (it can be one channel in a multi-channel image). You have to specify a threshold value to segment the objects.
It is documented here.
The label image detector.
Label images are especially convenient as an output of segmentation algorithms. Indeed, in some cases you might have different objects that are so close that they touch each other. If a segmentation algorithm can detect them, but outputs a black and white mask, they will appear as one object in the mask if they share a border. In a label image, each object is represented by different integer values. For instance, the object #1 in a label image will be made from all the pixels that have a pixel value of 1, over a black background of 0. Object #2 will have the pixel value 2, etc. This allows resolving them even if they touch each other. This detector is also part of the core of TrackMate. It is documented here.
New detectors integrating major segmentation algorithms, in Deep-Learning, Machine-Learning and Morphology.
An important goal of the changes introduced in this release is to foster the integration of TrackMate with the major segmentation algorithms in our field. So we integrated 4 of them in TrackMate, coming from Deep-Learning, Machine-Learning and Morphology.
The StarDist TrackMate detector.
This detector requires that you subscribe to the CSBDeep and StarDist update sites from Fiji. It offers two new detectors that integrate StarDist in TrackMate, one using the versatile fluorescent nuclei model, and one for custom models.
It is documented here.
The ilastik TrackMate detector.
This detector allows for using an ilastik pixel classifier saved in an ilastik project file to process a source image in TrackMate. You need to have ilastik installed on your computed, and in Fiji, to subscribe to the ilastik update site.
It is documented here.
The Weka TrackMate detector.
This detector relies on a Weka classifier, that you can train using the Trainable Weka Segmentation plugin.
It is documented here.
The MorphoLibJ TrackMate detector.
Finally, we integrated the excellent Morphological Segmentation plugin of the MorphoLibJ.
It is documented here.
New and reworked numerical feature analysis.
The changes above prompted for big changes in the numerical feature framework. Now that we have the object contour, we can compute morphological descriptors. We also retired seldom used features and integrated existing ones that were available only via an external download so far.
Object shape features are available.
The 7 new detectors listed above return the object contour in 2D. We can therefore exploit them to measure the object morphology. When these detectors are used on 2D images, the following new morphological features will be automatically computed:
- Area;
- Perimeter;
- Circularity;
- Solidity;
- Ellipse 2D fit (X0, Y0, minor axis, major axis, angle and aspect ratio).
These new features are documented here.
Intensity measurements are made on all channels.
Before this release, a TrackMate user had to rely on a 3rd party extension to access the intensity measurements in all the channels of a multi-channel image (by Benoit Lombardo). Now multi-channel measurements are integrated in TrackMate, transparently for the user.
Intensity measurements reports the:
- mean
- max
- min
- median
- sum
- and standard deviation
of the intensity for all channels of the source image. When object contours are available, they are used for intensity measurements as well.
This is also the case for the Spot SNR and contrast features.
New track features: track motility features.
A TrackMate extension provided several track features useful in motility analysis. They are now integrated into TrackMate natively. They are documented here.
Some features have been renamed for clarity.
- Edges
- "Velocity" -> "Speed".
- Tracks
- "Gaps" -> "Number of gaps"
- "N spots" -> "Track N spots"
- "Complex points" -> "Number of complex points"
- "Duration of track" -> "Track duration"
- "X location (mean)" -> "Track mean X". The same for Y and Z.
New tracker: the overlap tracker.
TrackMate has a new tracker that best exploits the fact that object can now have contour: the overlap tracker.
Its usage is best explained with a drawing:
The new display settings system.
We rewrote entirely and extended the display settings in TrackMate.
They are many more display options for you to fine tune, and they are configured in a separate panel.
The new options are documented here.
Common display settings editor.
A new plugin entry lets you configure the defaults that will be used in future tracking session. You can find it in in Edit › Options › Configure TrackMate display settings…
Settings are saved with the data.
When you save a TrackMate session to XML, the save file will include the display settings you configured. When you will reload the data, the display settings will also be loaded and used.
New table views.
We reworked entirely the data tables that can be generated in the view panel.
There are now two new buttons, next to the TrackMate scheme button, that generate data table for the tracks.
The first one - Tracks
- will show generate a table only for the objects that belong to tracks. The data is split in 3 tables, one for spots, one for links, and one for tracks. This table is empty when you have spots but no tracks (e.g. when you have only one time-point).
The second one - Spots
- will show a table for all spots, regardless of whether they are in a track or note.
Both table can be searched using the Search
box. The search will go through names and labels.
The tables abide to the coloring yoy set for all views. By clicking on the coloring
button in the tables, the display in the table will toggle between colored and non colored.
The data can be sorted, and exported to CSV using the Export to CSV
button in the top-right of the table.
Finally, the tables are in sync with the other views. For instance if you select a track, a spot or an edge in the table, it will be highlighted and selected in the main view as well.
This is also the case for the "branch table" that is generated with the Branch hierarchy analysis
action in the last panel of the UI:
Reworked the feature grapher framework.
We also reworked the grapher tool you can find in the next panel.
It now offers 3 buttons that allows for generating a data graph with
- all the data
- only what is currently selected
- only the tracks of what is currently selected.
We removed the small grapher tool from TrackScheme, because it was duplicated this feature, but less nicely.
The plot now properly shows connectivity. If two dots in the graph are linked by a line, it means that in the data model, the two corresponding objects are linked over time. This allows eyeballing the evolution of a feature value over complex tracks.
Also, the plot abides to the coloring scheme active when the plot is generated:
Changes in the Wizard user interface.
Skip the selection of a view.
The wizard does not let users chose the view anymore. So far there was only the main view, and the 3D viewer. The latter has been retired, so we can skip this part in the GUI, which makes it more concise.
Animation.
The GUI is animated. It is not useful.
More processing steps are cancelable.
The Cancel
button will appear for all lengthy computation steps: spot detection, spot and track feature computation, tracking.
The log panel gives more information.
More details on algorithms and parameters used in every step.
New actions.
Gaussian peak fitting to refine spot position.
A new action allows fitting all spots by a Gaussian peak, to refine the spot location in an unbiased way.
This is very useful in super-resolution applications.
Features removed.
Spot editing with double-click.
The main view allowed to edit a single spot by double-clicking in it. This possibility was removed in v7 (it was confusing everyone when we taught TrackMate).
Feature analyzers removed.
- Spot features
- The 'Estimated diameter' feature has been removed.
- Track features
- The 'Track quality' now just returns the mean quality: mean of the Quality value of the spots it contains.
The 3D viewer is not available anymore.
The TrackMate 3D viewer was crashing as soon as we had more than 1 time-point. The 3D Viewer on which it was based on has been unmaintained in a very long time. So we removed the TrackMate 3D viewer entirely.
The Block LoG detector is not available anymore.
Not really useful.
Backward and forward compatibility considerations.
TrackMate XML files generated with versions <7.0.0 can be opened in the new version.
TrackMate might show warnings about missing detector of feature keys, because we changed their name or removed some of them. However all the data in the file will be loaded.
Also, TrackMate files generated with version >= 7.0.0 can be opened with TrackMate version 6.0.3 (the version uploaded to Fiji just before this one). There will also be warnings and complaining, but the data will open. Of course, if you saved some data with contours, they will be displayed as circular spots in the old version (but with an adequate radius).
Code changes and developer-related changes.
A new API to create spots with object contours in a simple manner.
This API was made to simplify developing new detectors that return object shapes, whether you want to specify it as a polygon, or extract it from a mask, a grayscale image with a threshold or a label image. It is documented here:
https://imagej.net/plugins/trackmate/custom-segmentation-algorithms
Code structure changes.
The plugin name is now TrackMate
without the underscore _
.
The underscore was used in ImageJ to recognize plugins, but we do not need it anymore.
Consequently, the location of the jar has moved: it was in Fiji.app/plugins
, and it is not in Fiji.app/jars
.
All the TrackMate extensions will respect the same convention. They will be named TrackMate-Something.jar
and put in the jars
folder.
Multithreading.
I redid the multithreading entirely. We were using the ImgLib2 SimpleMultithreading
classes that were deprecated some time ago. We now use regular core multithreading classes.
New interfaces for spot detection.
To be able to integrate some external algorithms natively in TrackMate, I had to extend a bit the hierarchy of interfaces for spot detection. The new hierarchy allows for flexibility in dispatching time-points for processing. You can either
- specify that one time-point will be processed at once. In that case TrackMate will process one time-point per thread, processing as many time-points in parallel as you specified in the Edit > Options > Memory & Threads menu item.
- specify that there should be no multi-threading at all. In that case TrackMate will process one time-point after another, and assign all the threads to a single time-point. This is what we did for StarDist.
- specify that all time-points should be provided to the spot detector at once. In that case the spot detector itself handles how it multithread and process multiple time-points itself. This is what we did for ilastik.
More developer documentation is available on this topic here:
https://imagej.net/plugins/trackmate/custom-segmentation-algorithms#controlling-the-slicing-of-time-points
New interfaces for spot feature analyzers.
I had to change the interface for spot feature analyzer to allow for analyzers that processes multiple channel (such as the spot intensity analyzer).
The SpotAnalyzerFactoryBase has a method that receives how many channels the source image has. This can be used by implementing classes to possibly create one feature value per channel.
For an example see SpotIntensityMultiCAnalyzerFactory
The TrackMate class is Cancelable
.
TrackMate implements SciJava Cancelable
so you can interrupt any calculation by calling cancel()
on it.
The cancel message will be dispatched to the current process.
Of course, for this to work, the process currently executing must be cancelable, but with this release, almost all processes (spot detection, feature computation, tracking) are cancelable.
Remove uses of deprecated code.
There are no more calls to deprecated code in TrackMate.
Removed unused classes.
- Removed all mentions and uses of the 3D Viewer.
- The loader for TrackMate files of version <2.0.0
- The Icy track loader (for now).
- The old LAP trackers.
- The old morphology feature analyzers (that used intensity moments and were not accurate, invisible since more than a decade).
Acknowledgements.
This major release was prompted of course by the covid-19-induced lockdowns and by people trying to have me write grants and articles. But it was made possible by the authors of the segmentation algorithms we integrated.
We are thankful to their respective authors and maintainers for their support, permission and the quality of their code, that made it possible: Anna Kreshuk, David Legland, Dominik Kutra, Ignacio Arganda-Carreras, Martin Weigert, Siân Culley, Uwe Schmidt.
The code and documentation and examples you see associated with this release have been written by the TrackMate v7 team: Dmitry Ershov, Minh-Son Phan, Joanna W. Pylvänäinen, Stéphane U. Rigaud, Guillaume Jacquemet and myself. With the help of Daria Bonazzi, Guillaume Duménil, James R. W. Conway, Laure Le Blanc and Romain F. Laine.
A special thanks to Tobias Pietzsch. Working with him on the Mastodon project, I learned new skills and patterns in programming I could reuse in TrackMate.
Some parts of the new code in v7 were inspired or adapted from code authored by Kim van der Linde, Michael Doube and Wayne Rasband.