Skip to content

Commit 7cb20b8

Browse files
authored
Update main script example
Add a long comment that states how important it is to compute features before filtering on them. This is a recurring problem.
1 parent 27eeba3 commit 7cb20b8

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

scripts/ExampleScript_ExecTracking.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,12 @@
3535
# Some of the parameters we configure below need to have
3636
# a reference to the model at creation. So we create an
3737
# empty model now.
38-
3938
model = Model()
4039

4140
# Send all messages to ImageJ log window.
4241
model.setLogger(Logger.IJ_LOGGER)
4342

4443

45-
4644
#------------------------
4745
# Prepare settings object
4846
#------------------------
@@ -73,9 +71,20 @@
7371
# yield numerical features for the results, such as speed, mean intensity etc.
7472
settings.addAllAnalyzers()
7573

74+
# The line above is VERY IMPORTANT if you want to filter spots or tracks.
75+
# By default the TrackMate settings do not include feature analyzers, and the
76+
# objects you will get from tracking will only include the very minimal
77+
# feature set needed for TrackMate to operate. This might be advantageous
78+
# if you want to go fast. If you want however to compute specific features and / or
79+
# filter spots based on these filters, you need to explicitely include the corresponding
80+
# analyzer into the settings object. Filtering will not work without that. For instance,
81+
# if you try for to filter spots with a feature that was not calculated by an analyzer,
82+
# you will have 0 spots after filtering.
83+
# With `settings.addAllAnalyzers()` we simply add all the analyzers that TrackMate
84+
# can find. Since they are relatively fast, this is a convenient method.
85+
7686
# Configure track filters - We want to get rid of the two immobile spots at
7787
# the bottom right of the image. Track displacement must be above 10 pixels.
78-
7988
filter2 = FeatureFilter('TRACK_DISPLACEMENT', 10, True)
8089
settings.addTrackFilter(filter2)
8190

0 commit comments

Comments
 (0)