soft-matter / trackpy

Python particle tracking toolkit
http://soft-matter.github.io/trackpy
Other
441 stars 131 forks source link

Using raw intensities for calulating moments of intensity (m0) #681

Open Altairch95 opened 2 years ago

Altairch95 commented 2 years ago

Hi, I would like to use the raw intensities of the resulting blobs when applying tp.locate() to calculate the moments of intensity of the corresponding blob.

The formula to calculate the moments of intensity, as described by Crocker and Grier (1995), goes as follows:

image

where m0 and m2 are the moments of intensity, calculated from intensities of spots with refined positions.

Does trackpy calculates the moments in the refinement of positions part of the workflow? If not, how can we extract the raw intensities from the blobs before calculating raw_mass?

Thanks!

nkeim commented 2 years ago

If you are letting locate() do the preprocessing (the default) then it will automatically use the original raw image for the raw_mass.

If you do the preprocessing yourself, be sure you are using both the image and raw_image arguments to locate().

The preprocessed image is always used for m2 (which trackpy calls size), because this is taken to be a truer representation of shape and physical size. The choice is less important there since the mass is divided out.

b-grimaud commented 2 years ago

Sort of on topic : I looked through the docs for batch and locate, and it seems only ther latter takes raw_image as an argument. Does that mean final characterization is done strictly on images before trackpy's own preprocessing ? I have my own preprocessing pipeline upstream of batch and thus do not use preprocess, and I would be interested in feeding it "true" raw images.