Segmentation for different object

Hi QuPath team,

Thanks for inventing such software and your thresholding strategy somewhat unique. I tried different software to segment and find my object of interest, microfluidics droplets. Maybe I am in a wrong room, but, I see that QuPath has the capability to do it (correct me if i am wrong). After trying to do the counting, I got some issue in making the annotation automatically using either the cell detection or positive cell detection feature. The main goal is to detect the whole droplets and then distinguish the one that contain something in the droplets. Is there any workflow that I might be able to explore more? or some other example that might help me to answer my question?
I put a sample image here and look forward to your reply.
Once again, thanks a lot!

Best regards,
Example.tiff (4.0 MB)

I use imagej. This is what I came up with :

I used the following macro :

run("Duplicate...", "title=1");
run("Duplicate...", "title=2");
run("Subtract Background...", "rolling=150 create");
run("Find Maxima...", "prominence=1 output=Count");
run("Find Maxima...", "prominence=1 output=[Point Selection]");
run("Properties... ", "  point=Circle size=XXXL list");
run("Duplicate...", "title=3");
setAutoThreshold("Default dark");
//setThreshold(6, 255);
setOption("BlackBackground", true);
run("Convert to Mask");
setAutoThreshold("RenyiEntropy dark");
//setThreshold(21, 255);
setOption("BlackBackground", true);
run("Convert to Mask");
run("Analyze Particles...", "add");
roiManager("Show All without labels");
roiManager("Set Fill Color", "blue");

Please let me know if this work

Thanks @ims, with QuPath you aren’t limited to cell detection - in your case you might need a custom detection method, e.g. using ImageJ (@Mathew’s macro looks good to me!). If there are other features within QuPath you want to be able to use, you always can combine the ImageJ & QuPath (see here).

I also had a quick look with QuPath using the pixel classifier (v0.2.0-m8, using the displayed features + ‘Advanced options’ to set a thick boundary class to get the white outlines to improve separation). This provides another way to achieve a custom detection:

QuPath’s pixel classifier is still a work in progress; you might find it sufficient for your needs, but if not you could checkout either ilastik or Trainable WEKA Segmentation in Fiji for similar techniques.

However, you may well be able to skip this entirely and use ImageJ/Fiji as @Mathew has shown.


Thanks for making this macros, @Mathew
I also tried to do it with ImageJ previously and got a problem when I ran it through the whole datasets.
But, when I tried, it generates this issue:
Error: “XXXL” is not a valid choice for “size” in line 10:
run ( “Properties… " , " point=Circle size=XXXL list” <)> ;
I am not sure why. This still generates the counting (from particle analyzer, I guess).
And, I couldn’t get the picture you posted.

It seems okay with the counting and to me, looks make sense (I ran it for my data sets).
I am just curious, do you know why I got the error and why I couldn’t get the picture?
Thanks a lot!!

Also for @petebankhead, I will try to do it with QuPath. I think I haven’t installed the newer version. I’ll give it a shot. Thanks! I’ll keep you update.



Hi @ims
I tried on my computer, it works well with or without the line 10 using imageJ. So I don’t really know why it’s not working on your side

Hi @Mathew,

which imageJ version did you use it?
I tried with the one from original imageJ website ( and from fiji ( did not work the same. I only got the one below :smiley: hmm… interesting…
but, thanks! I’ll try to explore a bit then.

3.tif (4.4 MB)