Calculate Image Overlap - finding true positive value


I’m using the Calculate Image Overlap module and I would like to get an output value for true positive pixels. Is this possible? If so, how?


Hi Kilgore,

No, this is not an output of the module currently. It would be easy enough to expose the true/false positives/negatives as they are certainly calculated internally, but we apparently chose to output only the statistical parameters here. In the next version of CellProfiler, I will put in a request to make these simple values available.

I also tried to do some algebra to see if it was easy to recover TP from Recall, Precision, False negative rate, and false positive rate, but I couldn’t do it in 15 minutes. :smile: So perhaps someone else can try this and see if there is a simple transformation of the current output that would do this?


Our software engineer has made a change just now(!) that outputs True Positive Rate as well as True Negative Rate. Is that sufficient? Or did you want the actual True Positive pixel count? TP/TN counts would be easy enough to report for images, but for individual objects it is apparently not so easy to judge.

Note that the change is made in our most current version, possibly unstable, with a changed interface, and pipelines in it won’t be back-compatible. They are available at the bottom of this page:

Hi David,

Thanks for your response and help! However, I was just looking for the true positive pixel count for the image. If you guys could output that in the experimental version, that would be extremely helpful. If not, now that I have more equations / values I could also take another stab at solving for true positive pixels.


Hi Kilgore,

OK, we’ll see if we can add that, too.

But in the meantime, you can actually count the overlapping pixels via other means. You could:
(1) use MaskImage to mask out the pixels from the second image on the first (you may need to check the invert box, if you want True Pos vs. True Neg)
(2) ApplyThreshold on your MaskImage output, since the MaskImage output is not necessarily a binary image. Be sure to choose “output image type” as Binary.
(3) MeasureImageAreaOccupied applied to the Binary image just created will count the pixels

I agree that the more elegant solution would be CalculateImageOverlap with the TP count, but the upgrade to the ‘bleeding-edge’ CP version might be more painful than just implementing the solution above.

Hi David,

Great! Thanks so much for the tip! Just fyi, I did make a pipeline using the ‘bleeding edge’ version this morning and it worked pretty well. The only snafu that I seemed to notice was the the values that were displayed in the CalculateImageOverlap module disappear after a few seconds. However, seeing as they were being saved in the spreadsheet anyway, it didn’t matter much.

Thanks again for all of the help. I really appreciate it!


OK, good. I can’t seem to replicate the disappearing displayed values on my Mac, but we’ll keep any eye out for that.