Track Objects: LAP 2nd Phase workaround?


What I have understood so fare is that what shows up on the image for Track Objects is not the finale labelled objects if
I use LAP 2nd Phase?
Since Im working with foci that appear and disappear from image to image, (Either because of Z-stacking images, or because of the time course)
I need to use the LAP 2nd Phase, but tune them so I don’t get all kinds of artifact and so on, is really hard to do, when I can’t see how well the 2nd phase tracks
my objects is there any work around that people are using, or is the any you can think of??

Hi Karen,

You are correct in that the revised labels for LAP 2nd phase are not shown on the labeled images. This is because the 2nd phase takes place at the end of the analysis run, once the 1st phase tracks have been collected. This puts the 2nd phase computation in an odd position, in that the final results are not visible to the user until the output is finished.

At this point, there is no workaround; it’s a limitation that we’ve encountered as well. At this point, we use additional scripts written in R or MATLAB to extract the data from the output file (i.e., the DefaultOUT.mat file) and then visualize the results outside of CellProfiler. If you have any programming ability in either of those languages, I can send you the scripts. The plan on our end is to devise a solution, but we do not have a timeline as to when.


I have experience with Matlab, so that would be a great help.

I also have a small amount of experience with R, but a Matlab script would be easier.


Hi Kristian,

I’m attaching the MATLAB scripts that I use. There are a few comments but I haven’t documented much. Basically, it creates a (x,y,t) plot in which each track is represented by a colored set of dots, with the track number labeled at the end. I visually look at these tracks and note areas where the tracks change color/have a different label, but really should be a single contiguous track.

Hope this helps!
plot_time_series.m (4.17 KB)

Hi Mark,
Could you also post the R script? That would be great.
I am also using the LAP Track with the 2nd step and have encountered a problem. In one ImageNumber I get several Objects with the same TrackedObject_Label in the output file. I guess that this happens in the postprocessing step since there are no double labelings on the image. I guess the problem lies in the assinged gap costs, did anyone else encounter that problem? Is there a way to workaround that problem?


Hi Stefanie,

Here is the R code and discussion for visualizing tracks. As far as I know, it should work with post-2nd phase LAP data still.

As noted here, “… if the object splits or merges, the label is inherited by the progeny”. Is that the behavior you’re seeing? As you can see, this is on our list to clarify at least. Mark may have a better handle on this…


Thank you David for the R code and for your answer!
I guess that might be the problem. I wasnt aware that the LAP Track also assigns Labels according to a parent/child relationship. I knew that the Distance Tracking does but thought the LAP assigns new Labels for new Objects. That would definitely explain my problem since I am trying to track Objects that are highly interactive. If I’m not using the 2nd phase I should get unique labels, right? Thanks for clarifying it, that saves me a lot of time!

Glad to help!

That’s right.