Applying LAP trackobjects to an extrnal data

Hello,

My current project involves 3d particle tracking.
The challenge I am dealing with at the moment is the assignment problem (the linking of a set of already identified 3d positions of particles in consecutive instances into time-lapse trajectories).

I would like to know how to apply the LAP trackobjects to a dataset not originating from CellProfiler.

My database consists of arrays containing the positions in 3D of the particles at different times, each array resulting from the analysis of one frame from a set of consecutive images.
The arrays are currently numpy arrays, but this could be converted to other formats.

Furthermore, which parts of the code (files, functions, lines if that’s possible) should be modified in order to process 3d data rather than 2d (I assume the modification is rather trivial, is this correct?).

Looking forward to your reply,
Eldad

I would suggest looking at the units tests we’ve written for TrackObjects. We’ve recently moved the CP repository to GIT (github.com/CellProfiler/CellProfiler); from there, you can check out the file test_trackobjects.py in .\CellProfiler\cellprofiler\modules\tests. In that file, you can see how to pass the minimal set of numpy arguments to the TrackObjects module and return a result.

I suggest looking at TrackObjects.py; the coordinates first come into play at line 1194: label, object_numbers, a, b, Area, \ parent_object_numbers, parent_image_numbers = [m.get_measurement(object_name, feature, i).astype(mtype) for i in image_numbers] for feature, mtype in ( (self.measurement_name(F_LABEL), int), (cpmeas.OBJECT_NUMBER, int), (M_LOCATION_CENTER_X, float), (M_LOCATION_CENTER_Y, float), (self.measurement_name(F_AREA), float), (self.measurement_name(F_PARENT_OBJECT_NUMBER), int), (self.measurement_name(F_PARENT_IMAGE_NUMBER), int) )]
From there, you can look forward to see the code path for the coordinates and modify as needed.

Regards,
-Mark

Hello

Thanks for the answer but I still have not solved this problem.

I may have not clarified this in my first post but I need to apply the function onto an already known set of positions.
That is, I already have the (3D) coordinates of the particles appearing in each image.
The examples I found in the test_trackobjects are based on (numpy) labeled arrays for the first stage of Jaqaman’s LAP.
I believe I found in the test file examples which are independent of the image analysis step, but these seem to be relevant only for the second stage of Jaqaman’s LAP.

Is the only way for me to use the function in CellProfiler “as is” (say for 2D case) is by converting my data (which consists of coordinates for point-like objects) into labeled arrays?
If so this may turn the process very inefficient.

I would be thankful if anyone could provide me with some more input on this matter (Am I right in what I wrote above?)
As I could not figure it out myself, it would be very helpful if someone could post a (working) short example code running trackobjects (LAP) on a database of the sort I have, ie to something of the structure:
[Timestamp, X-coord, Y-coord, Z-coord] x Number of identified particles in the whole set of frames.
(an example for the 2D case would also help a lot as a starting point).

Thanking you all for your time,
Eldad