While analyzing particles we can specify particular range to include, but how can we do if we need two range in size? lets say pixel size=5000-8000 and size=10000-12000

Sample image and/or code

run(“Analyze Particles…”, “size=3000-50000, 10000-12000 circularity=0.00-0.50 show=Masks display exclude add”);
This code does not work for two range in size.

Hi
@amaze
Here is a possibility.

run("Blobs (25K)");
setAutoThreshold("Default");
//run("Threshold...");
//setThreshold(126, 255);
setOption("BlackBackground", false);
run("Convert to Mask");
run("Set Measurements...", "area display redirect=None decimal=3");
run("Analyze Particles...", "size=0-250 display overlay add");
RoiManager.setGroup(0);
RoiManager.setPosition(0);
roiManager("Set Fill Color", "blue");
run("Analyze Particles...", "size=550- display overlay add");
roiManager("Select", 24);
roiManager("Select", newArray(24,25,26,27,28,29,30,31,32,33,34,35));
RoiManager.setGroup(0);
RoiManager.setPosition(0);
roiManager("Set Fill Color", "green");
roiManager("Show All without labels");
2 Likes

Thanks @Mathew

I am able to interpret your code and changed to my solution. I appreciate your support.

Similar to Mathew’s suggestion, you could also simply run the Analyze Particles twice with the two size ranges and combine the resulting two masks with OR. Doesn’t show the two size ranges in different colours, but creates a mask that contains the particles in both ranges.
Cheers, Volko

run("Blobs (25K)");
setAutoThreshold("Default");
setOption("BlackBackground", false);
run("Convert to Mask");
maskID=getImageID();
run("Analyze Particles...", "size=0-250 show=Masks");
rename("Small");
selectImage(maskID);
run("Analyze Particles...", "size=550- show=Masks");
rename("Large");
imageCalculator("OR create", "Small","Large");

3 Likes

@Volko Thanks for your code, I did same thing by combining ROI elements and created mask, however; if no element selected it led to error which need to handle. Your code eliminate this problem. Thank you.