TrackMate Spot Detection Accuracy Question

Hello,

@tinevez

We are having some questions related to the accuracy with which TrackMate does the sub-pixel particle localization.

1.) https://imagej.net/TrackMate_Algorithms
"To improve the localization accuracy, and extra step is taken to yield a sub-pixel localization of the spots. The position of each spot is recalculated using a simple parabolic interpolation scheme, as in [Lowe]"

We could not find the [Lowe] reference on the wiki; is it maybe missing? In addition, maybe it could be good to add a few words about what the “parabolic interpolation scheme” is?

[EDIT: I just found that on below website the [Lowe] reference is working: https://imagej.net/Getting_started_with_TrackMate
leading to this page: http://www.cs.ubc.ca/~lowe/keypoints]

2.) https://imagej.net/TrackMate_Accuracy#Accuracy_measurements.
The RMSE on particle position is the worst here over the 4 scenarios. This is the obvious consequence of the particle shape, which is asymmetric and elongated, when the LoG detector expects bright blobs. Still, this does not affect tracking results.

We were in fact wondering if the LoG and the DoG filter are taking into account the different width of the PSF in x&y and z; e.g., by using anisotropic Gaussian filters. Here, it reads like as if it does not. Could you please comment on this?

The background of our questions is that we would like to use TrackMate for very precise measurements of the distances of gene loci from fluorescence in situ hybridization staining; the signals here are diffraction limited spots, which basically have the shape of the PSF; typical distances are sub-micrometer.

Thank you very much,
Best wishes,
Tischi

Not exactly answering your questions above, but please also have a look at this lengthy discussion about subpixel location accuracy :slight_smile: :

1 Like

@imagejan, thank you very much for pointing out this discussion!
It does show that the algorithm should be very good now in x,y, and z after all the fixes :slight_smile:

Did you try if the accuracy decreases for “elongated” objects (with different sigma in x&y vs. z), such a point objects smeared with the microscope PSF? That’s what above statement on the TrackMate Wiki seems to suggest.

From the discussion that you mentioned, it seems to depend on whether below code works well for objects where the sigma is different in x&y vs. z:

For above comment in the code, my feeling is that, irrespective of scaling, the local derivatives are computed in all dimensions at spacings of 2 pixels. If now an object is very elongated in one direction, one might actually get more accurate results using larger spacings, because changes in intensities that are spatially very close might be just noise-related and not real.

The DoG (or LoG) however should help in this matter, because the smoothing should get rid of the noise and (hopefully) only leave “real” intensity differences.

What do you think?

Hi @Christian_Tischer

So I have found out the old metrics I ran a while ago on the the sub-pixel localization of TrackMate.

1.

First, it’s not mine. It comes from an ImgLib2 class called SubPixelLocalization (https://github.com/imglib/imglib2-algorithm/blob/master/src/main/java/net/imglib2/algorithm/localextrema/SubpixelLocalization.java) by @StephanPreibisch and @tpietzsch. They built it for local descriptors used in several plugins such as SPIM registration, and descriptor-based registration.

1bis.

You found the correct link to the Lowe publication, I just fixed in the page, thank you.

2.

This comment in the accuracy assessment is related to the shape of the particle in the microtubule scenario, which is - in 2D - elongated in one direction and much shorter in another one (a bit like a bacteria). The LoG and DoG filter still expects round particles.

The LoG and DoG can deal with anisotropic calibration. That is: if the source image has a different pixel size in X, Y and Z or any combination of the 3, they will adapt their kernel properly so that they can optimally detect round particles BUT: round in physical units.

Your background.

I would not use the subpixel algorithm of TrackMate for the accuracy you seek. It is a fantastic scheme that has negligible computational cost and kicks some extra localization for very cheap. In Lowe publication, the author motivates its use by stating that it enhance the stability of the feature matching.

The problem is that it is biased. Even for noiseless images, it returns a localization that depends on where the true blob is centered. For instance:


(dont’ believe the title, there was no noise in this simulation)

Instead, you probably want to rely on gaussian-fitting scheme, or something that approaches Cramer-Rao bounds. For this, I would read the results of the super-localization challenge.

1 Like

Thank you very much for the reply!

May I ask about the plot?

1.) Does the x-axis represent the real sub-pixel position of the particle in the y-direction?
2.) Is the particle “pixel-centered” in x and z?
3.) If my interpretations regarding (1) and (2) are correct I do not understand why the “Error on y” never goes to zero (as it does for x and z)?

  1. No. see #2.
  2. dz=0, dy=0.4 and I vary dx.
  3. This is the bias I mention.

Bur more generally, I would like to regenerate these plots. There are about 12 of them to be complete, but as @imagejan said, we fixed some problems after these plots were generated. When I find the time I will put them on the wiki.

Did you look for the super-res challenge? If you ever build something based on this, it would be great to put it into TrackMate. No?

2 Likes

Ok, thanks!

Plot
I guess I should read the plot title :wink:
But then i don’t understand why the ‘Error in x’ is always low; at some point dx also is 0.4 (such as dy is all the time), why is only the y-position inaccurate?

Anisotropic LoG and DoG
Did you ever consider having anisotropic LoG and DoG in physical units? I guess many diffraction-limited spot tracking projects will have cigar-shaped PSFs as input data. In fact, I would not know if the detection process (and position accuracy) would improve a lot. Do you have any experience with this?

EDIT: Using the TrackMate API I think I discovered a hack to have anisotropic filtering:

  • During spot detection: change image scaling such that the DoG has the shape of the PSF
  • After spot detection: change x,y,z coordinates of all spots back to the original scaling of the image
    Do you think that’s a good idea?

Improved localization
Regarding the improved localization: Thanks for the suggestion of checking the super-res challenge. I will have a look into it and let you know if I find something useful.

Center of mass
May I ask for an add-on to TrackMate? Could you maybe add a CENTER_OF_MASS feature? This is what my collaborator so far used for determining the spot positions and he seemed to be happy with it. Looking at your code below, it looks like it could be added somehow like this:

inside neighborhood loop:
weighted_sum_x += val * pixel.getPositionX();
weighted_sum_y += val * pixel.getPositionY();
weighted_sum_z += val * pixel.getPositionZ();

outside loop:
center_of_mass_x = weighted_sum_x / sum;
center_of_mass_x = weighted_sum_y / sum;
center_of_mass_x = weighted_sum_z / sum;