soft-matter / trackpy

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

Calling tp.link on pre-segmented objects #711

Closed Ciro1990 closed 1 year ago

Ciro1990 commented 1 year ago

Hello,

I was wondering if it is possible to call the tp.link function on pre segmented objects (i.e. on Cellpose masks). I would like to try Trackpy on live imaging of cells (brightield) which have been segmented already with Cellpose.

Thanks! Ciro

nkeim commented 1 year ago

I'm not familiar with that package. What kind of output does it produce that link would need to process? (Is it different from an array of coordinates?)

Ciro1990 commented 1 year ago

Th output of Cellpose is an array of labels with the same dimension of the image, in which every pixel of the background has value 0 and for the pixels of the cells value >0. Pixels of the same object (cell) have the same label value.

nkeim commented 1 year ago

Thanks. It sounds like you can use skimage.measure.regionprops() to get the centroids of the labeled regions. See the trackpy bubble tracking tutorial for an example: http://soft-matter.github.io/trackpy/v0.5.0/tutorial/custom-feature-detection.html

Ciro1990 commented 1 year ago

Thanks a lot! It works now :)