Analyze particles to include in-hole particles

Hi,

I’m trying to analyze the particles (black on white background), however I couldn’t include the particles inside the holes.

The raw image to be analyzed:



Result after using analyze particles:

Then, I tried using the morphology plugin: http://www.mecourse.com/landinig/software/software.html and by using the Numberparticles8 option I could select all the particles inside the holes. However, my problem is that it only showed the numbered results and not ROI, I wanted to measure the properties in the “shape descriptor” in the measurement option, also to not select particles below 0.05 um^2, and possibly have the result as ROI set.

Result after using numberparticles8 of morphology plugin:

Therefore is it possible to convert the results of Numberparticles8 into ROI so that I could measure it using the imagej measure option, or is it possible to include the particles inside the holes by modifying analyze particles?

Nico

Did you try the Particles8 plugin from the same Morphology collection? That should be able to extract any particle regardless of size if they are binarised.

By the way, Particles8 works in pixel units exclusively, not calibrated units, so not quite sure what is the claim that it cannot select 0.05 um^2.

Thank you very much for your reply. Sorry for the confusion regarding the unit, I meant that in analyze particles it is possible to do it by calibrated units.

I tried particles8 plugin, I did get the following result after changing the options of particles8 (had to uncheck the white particles on black background option despite the image) which I think is what I was looking for, along with the measurements similar to those in shape descriptors:

numberparticles8

However, it does not label the particles by numbers/ROI in ROI manager (I guess it differentiates the results by color?). Is it possible to label the result with numbers?

Nico

To number the particles, use NumberParticles8. The numbers start at 0. If you want it to start at 1 (same as the Number column in the Result Table, modify that macro and change the line:

offset=0; //start numbering at...

with:

offset=1; //start numbering at...

To label the regions you better use the BinaryLabel plugin (no number after it!, it produces a 32bit image with unique colours = “Number” column in the Results Table (it is actually row number + 1 because 0 is reserved to the background).
If you use the BinaryLabel8 plugin, you get a 16bit image but if you have more than 65530 regions, the colours are recycled.
If you use the “Label” option of Particles8 the colour are recycled after 251. Depending on your application you might need unique colours or not.
Ask if this is not clear.

The particle analyzer includes particles inside other particles as long as you do not use the “Include holes” option. The following macro creates and analyzes an image with two particles inside a larger particle.

  newImage("Untitled", "8-bit white", 400, 400, 1);
  setColor(0);
  fillOval(41, 43, 300, 300);
  setColor(255);
  fillOval(64, 66, 250, 250);
  setColor(0);
  fillOval(87, 133, 100, 100);
  fillOval(198, 141, 100, 100);
  setThreshold(0,0);
  run("Set Measurements...", "area mean centroid");
  run("Analyze Particles...", "  show=Overlay display clear");
  resetThreshold;

Thank you for your reply. I am also looking to analyze the particle that has holes, in which the inner border is also outlined, unfortunately particle analyzer here assumes that the particle with hole has no hole (the ROI does not include holes).

Thank you for your reply. Is there any way to use the macro NumberParticles8 by filtering the size and to exclude edge particles as when using Particles8? Furthermore, regarding labeling by using the BinaryLabel8 plugin, I am not really sure why it is considered the better option compared to numbering, is there any specific reason why?

Please see in that macro lines 22 and 26 where it calls Particles8. You can set the minimum and maximum regions seizes.

Unless you know how many regions there are, it woul dbe safer to use “BinaryLabel” (i.e without the 8)
Numbering generates an image with the “burnt in” particle numbers.
BinaryLabel paints the regions in unique colours. They are very different things. You can extract a given region just by thresholding.

The particle analyzer does exclude holes when making measurements but ROIs added to the ROI Manager and overlays ignore holes, a bug that is fixed in the latest daily build (1.52k9). The following screenshot shows that the ROI for the first particle in your example image is now a composite ROI that excludes the two interior holes. It is drawn in magenta because I activated it by double clicking on the first line in the “Overlay Elements” table. You can also activate an ROI in an overlay by clicking on its label.

Screenshot

Dear Wayne, Gabriel,

Thank you for the responses. So far I have gotten the analysis done properly. Thank you very much!

Dear @Wayne,

I just stumbled over that older post and I currently cannot reproduce the described fix.

Currently running Fiji Version = 2.1.0/1.53c

I also tested it in ImageJ 1.53e. Same behaviour ocurrs.

Here a test macro:

//setup
setOption("BlackBackground", true);
run("Colors...", "foreground=white background=black selection=yellow");
run("Set Measurements...", "area mean standard modal min centroid center perimeter bounding fit shape feret's integrated median skewness kurtosis area_fraction stack display redirect=None decimal=3");

//test macro for particles with holes
newImage("Untitled", "8-bit black", 1024, 1024, 1);
run("Specify...", "width=400 height=400 x=312 y=312 constrain");
setForegroundColor(255, 255, 255);
run("Fill", "slice");
run("Specify...", "width=200 height=200 x=400 y=400 constrain");
setBackgroundColor(0, 0, 0);
run("Clear", "slice");
run("Select None");
run("Analyze Particles...", "display clear add");

Was this behaviour reversed after the fix on purpose or is this a regression? (or did I miss something in particular making a wrong assumption?).

Thanks so much in advance for investing time in this issue.
Kind regrads

Hi @biovoxxel,

Enable the particle analyzer’s “Composite ROIs” option in the latest daily build (1.53g35) and particles with holes will be handled as expected. Here is an example:

  newImage("Untitled", "8-bit black", 500, 500, 1);
  run("Set Measurements...", "area mean perimeter");
  setColor(255);
  fillRect(50,50,400,400);
  setColor(0);
  fillRect(150,150,200,200);  
  setThreshold(255,255);
  run("Analyze Particles...", "display clear add composite");

1 Like

Great. Thanks so much.