Getting duplicate spots with Trackmate LoGDetector (scripting)

Hello,

I’m having an issue when using the spot detector of Trackmate: Sometimes (or regularly for the data I use right now) I get 2 spots reported at exactly the same position. The quality of the spots differs, but position is really exactly the same.

I encountered this issue during plugin development, but here is a simpler jython script that reproduces the issue:

# adapted from here: https://imagej.net/Scripting_TrackMate
from ij import IJ
from ij import WindowManager
from ij.gui import Roi 
from fiji.plugin.trackmate import TrackMate, Settings
from fiji.plugin.trackmate.detection import LogDetectorFactory

# get current image + set a roi to focus on the essential spots
imp=IJ.getImage()
imp.setRoi(54,9,19,23); # obtain only the duplicate spot
#imp.setRoi(52,9,19,23); # obtain 3 spots: duplicate + one extra
    
           
# settings for spot detector      
settings = Settings()
settings.setFrom(imp)
       
settings.detectorFactory = LogDetectorFactory()
settings.detectorSettings = { 
    'DO_SUBPIXEL_LOCALIZATION' : True,
    'RADIUS' : 1.,
    'TARGET_CHANNEL' : 2,
    'THRESHOLD' : 100.,
    'DO_MEDIAN_FILTERING' : False,
}  
    
# create trackmate instance 
trackmate = TrackMate(settings)

# detect spots
ok=trackmate.execDetection()
if not ok:
    IJ.log(str(trackmate.getErrorMessage()))
    
# extract results
model=trackmate.getModel()
spots=model.getSpots()

print "Detected spots:" # 2 spots have the same coordinates
for spot in spots.iterable(False):
    x = spot.getFeature(spot.POSITION_X)
    y = spot.getFeature(spot.POSITION_Y)
    z = spot.getFeature(spot.POSITION_Z)
    q=spot.getFeature(spot.QUALITY)     
    print "x="+str(x)+",    y="+str(y)+",    z="+str(z)+ ",    quality="+str(q)


print "Done"

Example image to run with is attached, here is a screenshot (don’t worry about detection suitability, it’s just an example):
image

Example output:

Detected spots:
x=10.2291044402, y=3.29845536066, z=1.56419463118, quality=104.243080139
x=10.2291044402, y=3.29845536066, z=1.56419463118, quality=100.749504089

Some more details:
I use the LogDetector, no Tracking (since single time point), multichannel image, zstack

I thought that there is a non-maximum suppression during the spot detection, so I don’t understand what’s happening. Or am I missing something here? help is greatly appreciated!

stack_multichannel_duplicate_spot.tif (1.8 MB)

2 Likes