Analyze Particles giving error on ImageJ


Hi Guys,

I was following a document related to imagej earlier for particle analysis.

Somehow when i am using the last step of Analyze Particles, there are inaccurate results that I am getting. This imagej is running on windows 10. I was getting correct output earlier but today the module of analyze particles didn’t function.
Sometimes, I also get an error: “No particles were detected. The threshold (255-255) may not be correct”
Can anyone help here. What might be going wrong with the Analyze Particle function ? Or incase this is some other problem ?



Hi, can you please post examples where you get the “correct” and “wrong” results. It is essential also that you provide an example macro or script or a description of what exactly you are trying to do.

1 Like

I don’t have an example for “correct” or “wrong” results. But, here is the link which i followed for analyzing particles on imagej.

I am trying to quantify colonies on an agar plate but the colony count is under-estimated when i use imagej on windows 10.
If I use imagej on mac, then the results are close to as expected but those on windows 10 are giving error as I mentioned above.
May be if you could suggest how i can get the script for analyze particles, then i will be able to post the script ? Thanks, Rohitesh


The only way I could help is by running the same thing you did in another computer and try to work out what is the problem.
You could record the sequence of commands with the plugins>Macro>Record.


I am attaching here the image for one of the runs that i performed. As you can see, the original image has many colonies but the final count is much lower than the original one.

Even if i use plugins > Macro > Record, I won’t be able to see the code for “Analyze Particles” module on imagej. Do you know how to reach there ? Because, I am suspecting the problem is with this module rather than the steps performed for particle count. It’s working on my mac perfectly without any issue.


It is very difficult to help here because you are still not providing the original images or the code or an indication of what you consider to be a “right result”.
This is just a guess: your images are not thresholded correctly or you have incorrectly set “black background” in one of you computers.
Also you have a letter “b” which seems to be detected as an object…
Hope somebody else might have an idea of what you are expecting to achieve without code or images. Good luck!


Please find attached herein the image, thanks for all the help.colony
Please let me know if this works on your computer.



Do you have an ORIGINAL image file we could access to better help you? Just share it directly here or via a link to a file-sharing site (ie - Dropbox). Also - if you are interested… you can refine your workflow a bit to only count the colonies on the plate - excluding everything outside the ‘circle’. Is this what you aim to do - to count the colonies? Or just measure the overall area of them?


Thank you for your email. I am attaching here another image that I am interested in. I am only trying to calculate the colony count. Also, if individual area for the colonies can be obtained, that is an added advantage. I usually create an ROI on the image to calculate only within the ‘circle’ and not outside. This helps improve results. Please let me know if this attached file is good. Test


@rohitesh13 Can you share also the exact workflow you’ve been using? What has been working for you in general?



Too - looking at your dataset now… I believe you need a higher resolution image to accurately and robustly segment and count your colonies. At least in this particular image… if you zoom in - you can see that it is very difficult to discern what is a colony and what is ‘noise/shadow’:

Zooming in again… a ‘colony’ (if it is even a real colony) is only a few pixels in size. This is an issue - as you cannot reliable say something is real versus noise, etc.

1 Like

Hi, here is the workflow.
I can understand that the colonies are smaller but still i can get good results on a different computer. I don’t know what went wrong with the imagej on my computer, it is not working fine. I am getting terrible results. The health of my system is not well, because of which there aren’t good results. I hope you can understand and probably suggest something simpler to rectify the situation.

I am attaching herein the recorded code:

makeOval(113, 17, 4, 226);
makeOval(58, 17, 180, 226);
makeOval(20, 17, 218, 226);
makeOval(20, 17, 208, 226);
run("Duplicate...", " ");
setAutoThreshold("Default dark");
setOption("BlackBackground", true);
run("Convert to Mask");
run("Set Measurements...", "area mean integrated display redirect=Test.png decimal=3");
makeOval(86, 19, 28, 201);
makeOval(12, 19, 102, 201);
makeOval(12, 19, 179, 201);
makeOval(3, 19, 188, 201);
run("Analyze Particles...", "  show=Outlines display exclude clear summarize");

I am attaching here two results that I got for the same image using 2 different computers. Basically, the problem of the resolution doesn’t really come up if the imagej performs fine. Please find the results herein:


It’s hard for me to tell what is going ‘wrong’ (and what ‘wrong’ means in this case) via screenshots… But quickly looking you can see in one computer your image is inverting the LUT (look at the top of the image window for your two masks). That might be why you are having this issue… Make sure in Process > Binary > Options that Black Background is checked. You should be selecting (via Analyze Particles) - white particles(pixel values = 255) on a black background (pixel values = 0).


Is there a way to check the script for “Analyze Particles” on imagej ?


check for what? did you see if the settings were different between the two installations as I pointed out above?

The code call for setting that option is:

run("Options...", "iterations=1 count=1 black");

So perhaps adding this to the top of your script will ensure this is set correctly on each system?


I tried doing the way you mentioned to me, and I can get right results. But, what I don’t understand now is why on one computer white particles on black background are giving correct counts as compared to the other computer where black particles on white background are giving corrected counts ?


The ‘color’ of the particles doesn’t matter as much as the value of the pixels. Are the values the same (ignore the color)? If so… then it’s all good!


Okay, I will check that. If correct value can be calculated, then that’s good. By just observing, nothing can be said. I will use the software though! Thanks for all the help!


Hello rohitesh13,
Going back to your first post “No particles were detected. The threshold (255-255) may not be correct”
A threshold of this value will not show anything, try manually setting it and be sure the image is not inverted.