Getting duplicate spots with Trackmate LoGDetector (scripting)


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:
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.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.detectorFactory = LogDetectorFactory()
settings.detectorSettings = { 
    'RADIUS' : 1.,
    'THRESHOLD' : 100.,
# create trackmate instance 
trackmate = TrackMate(settings)

# detect spots
if not ok:
# extract results

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)
    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):

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)


Thanks @noreenw for documenting this issue here!

I’m coming back to this because I was dealing with some stacks where the LoG detector sees two spots close together, almost the same in x and y, but a bit apart in the z direction. Looking at the data, this might be caused by noisy signal extended in the z direction, so median-filtering as well as increasing the estimated diameter might help there, but I wondered if the issue you had seen also plays a role here, and, more importantly, if the DoG detector is also affected by similar issues.

I tried with your test dataset, and while I can reproduce with the LoG detector, I didn’t find parameters for the DoG detector that would show a similar behaviour. I would guess that the DoG detector might be more suitable for small spots indeed.

What’s your experience? Did you compare LoG and DoG detectors under this aspect?


Hi @imagejan,

I have not tried the DoG detector in depth so I cannot really say how it behaves compared to LoG . I can confirm that DoG does indeed not create a duplicate detection on my example image - the same as you observe.

Actually I was using the LoG Detector in the context of writing a colocalization plugin (link here), so I was not optimizing the workflow for a specific dataset. In the end I resolved to removing spots from the list which were at exactly the same position - not supersatisfied with this approach but it works and was the best fix I could come up with :slight_smile: Now that I think of it maybe I should switch to offering both DoG & LoG options…

This does sound different then (and more of a “real image issue” than an artifact, because all duplicates that I detected were really exactly the same position (<0.0000001um apart)

1 Like