Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions src/imcflibs/imagej/trackmate.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,44 @@
return settings


def set_spotfilter(settings, filter_key, filter_value):

Check failure on line 238 in src/imcflibs/imagej/trackmate.py

View workflow job for this annotation

GitHub Actions / Ruff ⚡🕵

Ruff (D417)

src/imcflibs/imagej/trackmate.py:238:5: D417 Missing argument description in the docstring for `set_spotfilter`: `filter_key`
"""Sets a TrackMate spot filter with specified filter key and values.

Parameters
----------
settings : fiji.plugin.trackmate.Settings
Dictionary containing all the settings to use for TrackMate.
filter_name : str
The name of the filter to be applied. You must use the keys of the features, not their name.
Here is the table of the feature keys and names for the spot features:
https://imagej.net/plugins/trackmate/scripting/trackmate-detectors-trackers-keys
filter_value : list
A list containing two values for the filter. The first value is
applied as an above-threshold filter, and the second as a below-threshold filter.

Returns
-------
Settings
The modified TrackMate settings dict with added spot filters

Example
-------
>>> # Set an above-threshold filter value for spot "QUALITY" without a below-threshold value
>>> tm_settings = set_trackmate_spotfilter(tm_settings, 'QUALITY', [120, None])
"""

Check failure on line 262 in src/imcflibs/imagej/trackmate.py

View workflow job for this annotation

GitHub Actions / Ruff ⚡🕵

Ruff (D401)

src/imcflibs/imagej/trackmate.py:239:5: D401 First line of docstring should be in imperative mood: "Sets a TrackMate spot filter with specified filter key and values."

settings.addAllAnalyzers()
if filter_value[0] != None:
filter_low = FeatureFilter(filter_key, filter_value[0], True)
settings.addSpotFilter(filter_low)
if filter_value[1] != None:
filter_high = FeatureFilter(filter_key, filter_value[1], False)
settings.addSpotFilter(filter_high)

return settings



def sparse_lap_tracker(settings):
"""Create a sparse LAP tracker with default settings.

Expand Down
Loading