Separating objects based on shape/size to do individual analysis




I am doing some analysis on some fluorescence images (example image below), and I am trying to separate the filamentous structure from the punctate (dot like structures) to run some analysis on both individually. I am trying to compare the two populations.

Ideally, I would use a method that uses minimal user input to avoid bias. However I am unsure how to do so. I have tried approaching this by doing simple thresholding, but by doing so i lose some of the terminal filamentous structures.

Any advice/recommendations would be strongly appreciated.
Thank you in advance,


Good day Max,

just two remarks:

  1. Your sample image doesn’t contain relevant color information, i.e. you may use an achromatic version of it, or, if you prefer, the red channel only.
  2. Your sample image is definitely over-exposed whch can make the desired analysis and especially thresholding difficult or even impossible.

One way you may try to achieve a reasonable separation is to binarize the image, do Analyze Particles with a restriction of small areas to get the “dot like structures” first. You may then eliminate them etc.



A first attempt with automatic threshold scheme “Moments” and upper size limit of 200:


Hi Herbie,

Thank you for the response.

The color information on the image is not too relevant at first since I want to selectively analyze both populations. I have been playing around by selecting ROI’s (either punctate or filamentous) via the Analyze Particles as you recommended, and then applied those ROI’s to an un-thresholded image so I can obtain measurements of the mean and integrated density.
My apologies for the exposure, I had turned up the brightness in the first picture so you could see the punctate structures. Find attached the raw image (.tiff and .jpg incase the tiff doesn’t work).

I will say I am impressed with what you have obtained via the Moments threshold scheme. I just tried it and did not get nearly the same product. Could you please explain to me how you got it?

Thank you,



I wasn’t sure whether the settings work with the original TIF-image which appears to be of good quality (only slightly over-exposed) but they roughly did!

With the “Yen”-scheme only small remains of the “dot like structures” can be observed. They can easily be removed.

  1. Apply the automatic threshold with “Yen”-scheme to the original image
  2. Analyze Particles with “Size 0-200 Pixel units” and “Add to Manager” checked
  3. Open the original image and transfer all ROIs from the ROI-Manager to it
  4. Combine all ROIs and save the result to the ROI-Manager and select this ROI
  5. Here you may enlarge the compound ROI (I used 2 pixels)
  6. Make sure the foreground color is black, then fill the selection

Here is what I get:

As mentioned, there are still some faint remains of the “dot like structures” that you can get rid of again by thresholding.




Good day,

here is an ImageJ-macro that performs the processing steps, except of step 5, and does a final thresholding which removes faint structures:

setForegroundColor(0, 0, 0);
setBackgroundColor(0, 0, 0);
setOption("BlackBackground", true);
setAutoThreshold("Yen dark");
run("Convert to Mask");
run("Analyze Particles...", "size=0-200 pixel add");
close("ROI Manager");
setAutoThreshold("Moments dark");
run("Convert to Mask");
run("Create Selection");
run("Clear Outside");
run("Select None");

Paste the above macro code to an empty macro window (Plugins >> New >> Macro) and run it with your image open in ImageJ.

Here is the result when applied to the sample image in TIF-format:

Please note the truncated histogram of the result image that is due to the final thresholding (the saturation of your image is also clearly indicated):
You must decide if this is tolerable or not.