Filter by particle intensity

Good day image experts,

I’m trying to threshold particles by their intensity. I have some protein particles that I stained with a fluorescent dye. I’m trying to count the brightest particles. Someone in this forum suggested to use Auto Local threshold which worked to some extent, but I’d like to measure particle intensity and then filter by that intensity, and to show only those particles in the outline masks. I’m also trying to figure out a way to get rid of excess noise in my images. I’m using a ccd camera to capture the images and I get rid of camera exposure noise by subtracting the average of an image stack taken when the camera is covered with the same exposure used to capture the images(black image at same exposure). This has helped some, but I still have noise that I’m not sure what the best way is to remove and not affect the shapes and count of my particles.

Here is what I do:
Remove camera exposure noise:

imageCalculator(“Subtract create stack”, “4hr stir 25 ms_1_MMStack_Default.ome.tif”,“Average Black 25ms.tif”);
selectWindow(“Result of 4hr stir 25 ms_1_MMStack_Default.ome.tif”);

Get an image that looks like this (some with low and some higher intensities)
different intensities.tiff (4.9 MB)

I’ve tried subtracting the background to get rid of this noise, but it doesn’t make a difference. Here is an example of the same image after using Auto Local Threshold:

run(“Auto Local Threshold”, “method=Phansalkar radius=25 parameter_1=0 parameter_2=0 white”);
Threshold phansalkar 25.tif (3.5 MB)

Then I run a median filter to get rid of that noise:
run(“Median…”, “radius=3”);
Threshold phansalkar #2.tif (3.5 MB)

When using this threshold method I pick up the lower intensity particles that I want to avoid. Following advice from this forum I measured the integrated density and redirected my measurements to my original image.
Mask of Threshold phansalkar #2.tif (3.5 MB)

From this point I’m not sure what to do to threshold by intensity and to show the outlines of the particles with intensities that I want. Is there a way to do this?

And could anyone offer a better way to get rid of excess noise that will not affect the particles I’m trying to count?

Thank you all for your help! I’ve learned a lot from this forum!

You can always add the particles to the ROI Manager then measure the intensity in the original image and delete the ROI below a certain intensity. For example using such a code (NOTE that this works you need to adjust the code!):

// add ROIs to ROI Manager
run("Analyze Particles...", "add");
roiCount = roiManager("count");

// measure mean signal
run("Set Measurements...", "mean redirect=None decimal=3");

// loop through ROIs from the top down
for (i = roiCount-1; i > 0; i--) {

	roiNum = i + 1;

	roiManager("Select", i);
    // perform measurement in original image
    // IMPORTANT: replace file name
	getMeasure = getResult("Mean", 0);
	print("ROI " + roiNum + " has mean value of: " + getMeasure);

	// here set criterium for rejection
    // IMPORTANT: specify a suitable intensity
	if (getMeasure < 100) {

        // delets ROI if signal is below the specified value
		print("Deleting ROI: " + roiNum );
	} else {
		print("Keeping ROI: " + roiNum );


In order to suggest alternative filter or thresholding routes you would need to supply an original image without the annotation.


Hi @schmiedc,

Thanks for the macro and tip! I will try this.
Here is the original image if you can offer additional ingiht I would appreacite it!

Original Image.tif (6.9 MB)

Here is another that has a lot of lower intensity particles:

Here is another image that has a lot more lower intensity particles:
Original #2.tif (7.7 MB)

Thank you,