Setting the same thresold for all images for different conditions and then analyze the particles

thresholding

#1

Hi, I want to analyze particles in different images but first I need to set the threshold. My method is to first do auto threshold for all images and write down the corresponding values for the upper and lower limit, then do the mean and apply the corresponding values to all images. Once this is done I can count the particles. However, the problem is that Image J is giving me different values for upper and lower limits when I open the same image repeatedly. Does anybody know how to best set up a threshold? Thank you


#2

You can simply set a fixed threshold with this macro snippet, e.g.:

setThreshold(0,50);

https://imagej.nih.gov/ij/developer/macro/functions.html#setThreshold
https://imagej.nih.gov/ij/developer/macro/functions.html#setAutoThreshold

You can get more commands simply by using the macro recorder:


#3

Good day Eva!

As it has been mentioned before many times already, you are to use one of the automatic threshold schemes if you are dealing with scientific image processing. The reason is that fixed thresholds don’t generalize and pose problems if results must be reproduced.

re generalization:
An automatic threshold scheme won’t generalize to an arbitrary degree, otherwise we wouldn’t need various kinds of automatic threshold schemes. However, for a certain kind of images you should be able to find a suitable scheme. If not, you may have a look at the reason that may be a large variability in image acquisition conditions.

If no automatic threshold scheme works for your images, you could start constructing your own. In general, automatic thresholding is based on the evaluation of image histograms and special schemes can be coded e.g. as ImageJ-macros.

An alternative to global automatic threshold schemes are local ones that come with the Fiji-distribution of ImageJ. In many cases however, the necessity of automatic local schemes is due to uneven illumination of the images which in fact is a problem of image acquisition and should be remedied there and not post hoc.

It would be helpful if you could post a few typical sample images (in original raw TIF. or PNG-format) that show the problems you are encountering with thresholding. Please explain in detail what you want and what doesn’t come out right.

Regards

Herbie


#4

Thank you Herbie for your helpful reply!

I am attaching a couple of pictures representative of the two groups of images that I want to analyze (controls, knockouts). In total I want to analyze 30 images, 15 per group.
My aim is to compare the number of particles between groups. In order to do that I need to find a the mean threshold so I can apply it to all images. Then I will be able to count the particles with the plugin analyze particles of ImageJ.
The problem that I am finding is that every time I open an image to do the auto threshold (default scheme) not always gives me the same values (upper, lower and percentage). How can I find consistency?
In order to apply the mean threshold value to all images I need to know which is the threshold value for a given image: it is the lower, the upper or the percentage value?
Thank you very much, I really appreciate your input in this matter,

Best,
EvaC3-102418_18-14_2%25%20PFA%20for%203%20min_GABRG2%20SYSY%2024h%20stain_Lt%20LS2_2-2%20GABRG2|nullxnull C3-102418_18-15_2%25%20PFA%20for%203%20min_GABRG2%20SYSY%2024h%20stain_Rt%20LS2_3-2%20GABRG2|nullxnull


#6

Good day!

Thanks for the sample images.

The problem that I am finding is that every time I open an image to do the auto threshold (default scheme) not always gives me the same values (upper, lower and percentage). How can I find consistency?

Please let me clarify the basics first:

  1. Automatic thresholds will hardly be the same for different images and this is intended.
  2. Using a fixed threshold does seldomly lead to reasonable results because it requires identical image acquisition and sample preparation that in general can’t be accomplished.

Only if you are sure that the staining and the image acquisition is exactly the same for all of your images, you may use a fixed threshold. (A fixed threshold can e.g. set in the threshold dialog by clicking “Set” and entering the desired values.)

If you can’t be sure, use a reasonable automatic threshold scheme and stay with this scheme for all of your images. Of course the thresholds will be different but they are computed from the individual histograms of your images and this computation is always the same if you stay with the same automatic threshold scheme. This approach guarentees that the threshold is adapted to the individual image but in a reproducible fashion!

Again, please think about the constancy of your sample preparation and image acquisition and if you can’t state for sure that all of your images are prepared and acquired in absolutely the same way, you need to use one of the automatic threshold schemes and stay with the once chosen scheme.

Regards

Herbie