soft-matter / trackpy

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

Radius vs. radius of gyration #649

Closed meredithefay closed 3 years ago

meredithefay commented 3 years ago

Hi,

I'm using trackpy for biological applications, where radius is a more relevant metric than radius of gyration. Is there a way to calculate radius? I'm using either tp.locate to identify blood cells in a single image or tp.batch and tp.imsd to track cells traveling through channels. Is there a way to link radius with a trajectory?

Thank you for any help you can provide.

nkeim commented 3 years ago

Trackpy's feature-finding algorithms were written with fuzzy, roughly circular blobs in mind (i.e. what most tiny particles look like under a microscope). Radius of gyration is a very straightforward way to measure a fuzzy blob of pixels, whereas there are multiple ways to measure the radius. That said, it may be possible to establish a conversion factor between R_g and R for the specific kind of object you're tracking.

The documentation includes tutorials for tracking bubbles/disks and rings — do you think either of those would work? The last resort is to use the coordinates output by locate() and apply some other kind of algorithm to that spot in the image, to measure the radius.

rbnvrw commented 3 years ago

@meredithefay let us know if this answers your question.

meredithefay commented 3 years ago

Hi, thank you for your response. Based on your suggestions, I used the coordinate output from trackpy locate, applied an adaptive threshold using openCV, and calculated the area of each resultant blob using scikit-image regionprops_table. Computational speed was not important and area was the desired output, so I found this approach most suitable.

Thank you for your suggestions.