Performing Cell Detection on Binary Masks

Hi everyone! I have a series of manually segmented binary masks from a pathologist, and I’d like to use QuPath watershed cell detections on these segmentations to gain digital parameters on them, particular the Centroid X and Y positions.
I’m currently using QuPath-m4, and when I drop the binary image mask (.png) inside, the segmentations suddenly become highlighted red, and no detections can made when I use watershed cell detection. Is it possible to get nuclei detections on a segmented binary mask?

I’m not sure what you mean by this?

Also, have you seen this post?

It might need updated, I’m not sure.

Is there any reason to use m4 rather than m8?

Ah, I think I understand now - if you drop the image onto QuPath it is being read by BioFormats as a separate image - and for some reason a red lookup table is applied.

Ultimately you’ll need to convert the binary image into an annotation on top of the original image open in QuPath. If the script above doesn’t work, you could try the following steps:

  • Open the image you want to measure in QuPath
  • Create a rectangle annotation around your entire image
  • Send the rectangle region to ImageJ at the same resolution as your binary mask; QuPath will launch ImageJ at this point
  • Open the binary mask image within ImageJ (not QuPath itself!)
  • Create a ROI in ImageJ in the binary image (ImageJ Create Selection command after setting a threshold)
  • Transfer the ROI from the binary image to the one send to ImageJ (ImageJ Restore selection) command
  • Send the ROI to QuPath as an annotation

(Sorry these instructions are a bit vague, I’m writing from memory on my phone and unable to check precise command names/menus currently - some further info is in the ImageJ section of the QuPath wiki)


Thank you this helped a lot! I’m not sure I followed your instructions perfectly but I sent my segemented image to imageJ from QuPath, and then did Image->Adjust->Thresholds and converted it to a 8-bit mask. Then, still in imageJ, I saved the image again as .png and opened that image into QuPath and detections worked perfectly! However, occasionally the raw image can’t be seen when I click on it. But all the detections are present.

1 Like