Calculating Image Overlap



I have recently started using CellProfiler and need to develop a very simple colocalization assay, only measuring object overlap. I want the pipeline to be able to compare two images, and calculate the percent overlap from Image B Objects inside of Image A Objects. If the Image B Object overlaps enough with the Image A Object (using some sort of threshold, from 0-100%), then the Image A Object should be a “hit”. At the end, I want to divide the number of Image A “hits” by the total number of Image A Objects, calculating a “percent of positive hits”.

I attached a simple diagram below. I want the pipeline to:
1.) Compare the two circles in Image A with the four circles in Image B.
2.) Calculate the black areas in the third (bottom) image, and divide this by the total area of the green circle it is enclosed by.
3.) If this percent overlap is above a certain adjustable threshold, then the green circle from Image A is considered a “hit”. For now, let’s just say the threshold is 0, so any overlap is considered a “hit”.
4.) In this case, since both green circles have some black area, both should come up as “hits”. So taking the number of “hits” and dividing by the total number of Image A Objects gives us 2/2 = 100%.

I have been playing around with these binary images before moving on to actual cells, but I can’t figure out how to calculate the object overlap. I have related the children (Image B Objects) to the parents (Image A Objects) but I’m not sure how to proceed after that. I attached the pipeline below.

Sorry for the length of the question, but any advice or help is appreciated! Please let me know if you need more files or information.
Thank you so much in advance.

Object Overlap.cpproj (540 KB)


You may want to take a look at the MaskObjects module, in which you can specify the amount of overlap an object must have with a masking object in order for an object to be retained. You can then use FilterObjects to retain objects based on the number of children masked objects (the black regions) are produced from a parent object (the green regions). The final filtered objects can be used to produce your per-image total by using CalculateMath to divide the filtered object count by the total parent object count.

Hope this helps!


Thank you so much, that is exactly what I needed!


Read “A novel method for detecting and counting overlapping tracks in SSNTD by image processing techniques”.