Sort images based on %area

I have a folder of a lot of images stained with DAB. I am trying to filter out those that weren’t stained or very weakly stained.

So far I have been able to make the color separation well. Now I am doing an “analyze particles” and based on the %area I want to be able to move the files into another folder.

I can’t figure out what the code should be though. I get the %area up in the summary table, how can I get the %area out from there?

So far my code is:

imageName = getInfo("image.filename")
run("Colour Deconvolution", "vectors=[User values] show [r1]=0.651 [g1]=0.701 [b1]=0.29 [r2]=0.269 [g2]=0.568 [b2]=0.778 [r3]=255 [g3]=255 [b3]=255");

selectWindow(imageName + "-(Colour_2)");


run("Convert to Mask");
run("Analyze Particles...", " display summarize add");

And now I would want to add something like:

if %area is < 0.1:

“move to folder”


  1. how do I get the %area from summary table?
  2. any suggestion that could be better to use than %area?


Hi !!! So… to get started… you can peruse the list of Built-in Macro Functions.

To get %area - you can use this code:

 //print(List.getList); // list all measurements
 percentArea = List.getValue("%Area");

(This is the example where I found the answer.)

Hope this helps !

eta :slight_smile: