Issues with exporting object number

Hello all,

First, I’d like to say that the cellprofiler seems great and I am very happy that I stumbled across it!

My main interest is to use this software to track cells migrating within a tissue over time, while identifying each cells neighbours at each time point. I hope to be able to use this data to be able to see when cells exchange neighbours and make contact with a new cell.

I have been playing around with the sample data set for object tracking provided on the cellprofiler website, and I noticed that when exporting data to excel (in both the primary objects file and the object relationships file) the image objects are not consistent. For example, when objects 1-6 are tracked for the first three frames, and object 1 leaves the frame, objects 2-6 are now reported as objects 1-5 in the exported excel data. This will be an issue when extending this process to imaging tissue with ~100 cells in frame, with cells entering and exiting every few timepoints.

First, I was wondering if there is a way to ensure that the objects retain their original identity when there are objects entering and exiting the frame at every time point.

Second, if anyone has any suggestions for an efficient process to identify events of neighbour exchange outside of manually looking at the object relationships for each object at every time point and noting if a new contact was made, I would greatly appreciate it!

Thanks for your time,

David

Hi David,

Short answer: Tracking is hard. You can try the LAP method within the TrackObjects module (I don’t think the example uses this method? I can’t recall but I doubt it). LAP does have facility to track objects that are dropped from a small number of frames, and I assume this would include objects that are not just missed due to being near the intensity threshold, but also the image boundary. The settings are a little difficult to set properly, but give it a try. It’s not easy to visualize the results of the second step in LAP, so we (well, Mark Bray) have written a tool to help with this called Tracer: cellprofiler.org/tracer/

Hmm, I suspect you’d have to write a post hoc script to do this, as I can’t think of an easy way to do this within CellProfiler.

Cheers,
David

Hi David,

Thanks for the suggestions! I’ll definitely look into the LAP method when I start to apply this to my own data, and the Tracer tool looks great for a final visualization of the tracks.

My original concerns are still here though, I’ve attached a few images to help illustrate my point. As you can see in t1, there is originally objects 1-6, but when object 2 leaves the field of view, there are only objects 1, 3, 4, 5, 6. The image output retains the proper identity of the objects. However, when exporting the tracking data to excel, when object 2 leaves the field of view after t1, the objects are now recorded as object 1-5 in excel, not 1, 3, 4, 5, 6 as in the images.

Is there a way that we can export the data to excel so that the objects retain their proper identity? The software is clearly capable of retaining the proper object number in the output images, but the excel object number seems to be based on the total number of objects, disregarding their actual ID. Further, when looking at the displacement data after object 2 leaves and object 3 is now reported as object 2, the displacement data for object 3 is properly carried over, but under the new identity of object 2. This will pose an issue when trying to identify when cells make a new contact, as when one cell leaves the field of view all of the object numbers are shifted.

Thanks again,

David.






I see what you mean now. Did you choose to output the Object Relationships csv? I believe this sort of object relationship info is contained here (though I haven’t looked there in quite some time, so I can’t be certain). It certainly does for MeasureObjectNeighbors and I believe TrackObjects relationships were added as well.

It may also be that you might find more TrackObjects functionality if you use our “bleeding-edge” version of CP here: cellprofiler.org/cgi-bin/trunk_build.cgi
But note that once you upgrade a pipeline, it cannot be retrograded.

David

I attached another example below, where another object enters that is labeled object 7 in the output images but is labelled object 6 in the excel output. Is there anyway to keep the excel data consistent with the image output? I.e. when object 7 enters, is there anyway it can retain its unique identity, instead of being identified as object 6, even though there was already is an object 6?

Unfortunately the issue is also present in the Object Relationships csv. This makes the output hard (if not impossible) to interpret, as the object numbers are changing from time point to time point even though the neighbours are not changing.






Below is an excerpt from the object relationships csv, showing the neighbouring objects for the same object (object 3 in the above pictures) over 5 frames. As you can see, when object 2 leaves the frame (images in my first reply), all the object numbers are reassigned and now instead of object 3 being neighbours with 4 and 6, we have object 2 neighbouring 3 and 5. This isn’t an issue with a data set where there are only a few objects, but scaling this up to a point where there are ~100 objects with multiple objects entering/exiting the field of view the output will become extremely convoluted and very difficult to interpret.

David


Hi David,

I have a few comments which I hope will clear things up:

  • The ObjectNumber is not intended to be used for tracking. It is simply a label/index that is assigned strictly on a per-image basis, and hence is expected to change as the total # of objects changes.
  • If you are using the TrackObjects module, it is the Label measurement that contains the unique tracking label; the ObjectNumber is not touched. That is, the Label index should persist with the tracked object. It is also this value which is shown on the module display window.
  • The relationship table is another schema for containing the tracking information. The table basically shows the link for each object represented by the “First” [ImageNumber,ObjectNumber] and it’s successor (“Second”) in a following frame, i.e, ImageNumber. It is more flexible than that contained in the per-object table because the relationship table can list merges and splits, whereas the per-object table does not permit this. A Label index can be derived from the relationship table, and in light of the flexibility, I would probably encourage users to do so.

Hopefully this helps!
-Mark

Hi Mark,

Thanks for the response. That does clear things up, I did not see the label measurement in the exported object table. Is there a way to have the object relationships table list the label index when listing the objects neighbour relationships instead of the object number? Or are you saying that I would need to use the latter half of the relationships table (that lists the parent relationships), to construct a label index that I could then apply to the neighbour relationships? If it is the second, do you have any suggestions for how I could do that?

Thanks,

David.

[quote=“mbray”]Hi David,

I have a few comments which I hope will clear things up:

  • The ObjectNumber is not intended to be used for tracking. It is simply a label/index that is assigned strictly on a per-image basis, and hence is expected to change as the total # of objects changes.

  • If you are using the TrackObjects module, it is the Label measurement that contains the unique tracking label; the ObjectNumber is not touched. That is, the Label index should persist with the tracked object. It is also this value which is shown on the module display window.

  • The relationship table is another schema for containing the tracking information. The table basically shows the link for each object represented by the “First” [ImageNumber,ObjectNumber] and it’s successor (“Second”) in a following frame, i.e, ImageNumber. It is more flexible than that contained in the per-object table because the relationship table can list merges and splits, whereas the per-object table does not permit this. A Label index can be derived from the relationship table, and in light of the flexibility, I would probably encourage users to do so.
    Hopefully this helps!
    -Mark[/quote]

I was under the assumption that TrackObjects_ParentObjectNumber_xx points to its own object_number itself in the previous frame. At the first time point these values are zero. In addition the tracking after manual inspection looked good.

Hi,

I have pretty much the same issue as David that I cannot clear-up with the replies posted here. I have a ONE time course (movie) that consists of 10 time points in two channels (so total of 20 .tiffs). I’m trying to track dots and their florescent intensities over time. I believe that I am importing these files correctly and assigning the proper metadata so they can be grouped together, but I’m not positive.

As David originally asked, the output image from TrackObjects is assigning unique numbers to each of my “spots” that I’ve identified. In total, across all 10 time points, there are about 4,000 unique spots (based of visually looking for the highest number in this output image). Each time point itself has about 850 unique spots (based off the exported image.csv). The issue is that in my .csv containing the TrackObject output data these unique spots seemed to be reassigned a new number, starting at 1, at the beginning of each new time-point .tiff. In other words, I never get an Object_Number or Object_Label higher than maximum number of spots identified in that time point/image. If you are saying “TrackObjects_Label” is the unique identifier of each spot persisting throughout the tracking, why are there five different “TrackObjects_Label” with a value of 3 for ImageNumber 1 (see attached screen shot)? Additionally, if the video displays a spot numbered “2700” and I can see this spot move throughout the output image, why isn’t there a spot (or any value) given “2700” in the output .csv. Did I group this image wrong back when importing my files? Did I not assign the correct metadata? It seems like it just doesn’t understand this is a time-series and all these spots are related throughout time (yet the output image does)? How can the TrackObjects give me clearly different number labels on an image compared to its corresponding .csv?

This is a hard question for me to explain over this forum, so let me know if something isn’t clear. I’m also happy to provide my pipeline, images that I’m using, and the output files. For now I’m just attaching screen shots of my pipeline with the discrepancies in data highlighted at the end. Thanks for all your help!

Julia

TLDR; When using TrackObjects, what is the unique identifier over time? Where is spot 2700? It’s in the output image but not in the output .csv!!!

Hi,

There’s a lot to go into in this post, but a lot of it stems from how the LAP Tracking algorithm works in CP - essentially, all your values are reassigned after the images are created, which is why the object numbers in the pictures don’t match the labels in the spreadsheet. It’s also trying to take objects that eventually merge and split and give them the same TrackObjects_Label.

Do you need LAP tracking (especially the second phase), or will one of the other methods do sufficiently well? Those are less difficult to configure and don’t do a lot of the behaviors you’re describing in your post.

If you do need LAP tracking, I’d suggest reading the module help for it very closely, and making some smaller cropped image sets (that contain dozens rather than hundreds of foci) and using those to optimize your LAP parameters before you move on to your full image sets.

Hi,

Yes, there is a lot going in this post, sorry! I really appreciate your help though. This is great. No, I don’t need LAP tracking so I will go ahead and play around with other methods. I’m trying to update our analysis (from a historic “black box” MatLab code) and that uses LAP, hence my choice to continue to use it. I also need to clean up my IdentifyingObjects and such beforehand, because the actually biology here doesn’t have events that “split or merge” so getting a cleaner identification beforehand would also help.

Again, thank you for your help! This community is awesome!

LAP is great, so I’m not dissuading you from using it, just saying it can take a lot of work to get fully tuned. Hopefully you can harvest some of your MatLab code to help find some of the key parameters!

And yes, better object identification ALWAYS helps with better tracking :). Good luck!