trackmate-sc / TrackMate

TrackMate is your buddy for your everyday tracking.
https://imagej.net/plugins/trackmate
GNU General Public License v3.0
169 stars 76 forks source link

Close gaps by detection and new framework for gap-closing methods. #242

Closed tinevez closed 1 year ago

tinevez commented 1 year ago

This PR offers a new gap-closing method and the means to add other gap-closing methods in the future.

Gaps are part of tracks where spots are missing in one or several consecutive frames. The gap-closing methods we are offering can introduce new spots in such gaps, depending on possibly the other spots in tracks and/or the image data. They are useful to fix missed detection when a uninterrupted list of position is required for track analysis. For instance in FRAP experiments, where you need to measure signal intensity changing during time, even if the spot is not visible.

So far TrackMate offered one method to close gaps, developed by @haesleinhuepf. It consists in interpolating the position and radius of missing spots.

In this PR we introduce a new method that execute a detection process around each interpolated positions. The detection is constrained to happen in the vicinity of the interpolated position, in a ROI of size a multiple of the spot radius.

The UI to choose and configure a gap-closing method looks like this: Screenshot 2023-01-17 at 18 40 46

Here the user chose the new gap-closing method. It can be configured with one parameter: the search radius factor, in units of the initial spot radius. The detection process reuse the exact same parameters that were used in the last detection step in TrackMate. They simply run on a smaller ROI.

For instance, if we create a gigantic gap between two spots well apart in time, we have a track that looks like this:

Screenshot 2023-01-17 at 18 40 27 (the first spot in time is in the top-middle location of the image, the last one in the bottom middle).

After running the gap-closing method with a search radius of about 5, we get this: Screenshot 2023-01-17 at 18 40 49 The new spots intercalated are positioned where bright objects are.

The algorithm takes the spot with the highest quality if there are several found.