Code of Set measurements

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Code of Set measurements

Adrián Villalba
Dear all,

I have the following piece of code which returns me a list of the area
measuraments of my interests:

run("Set Measurements...", "area centroid limit redirect=None decimal=2");
run("Analyze Particles...", "display add");


In consequence, i could have a list of hundreds of area values (this is my
expected outcome) but then i would like if there is a form to have a final
row with sum of all individual areas.

I know i can do it manually with R or other software but i think it will be
easier if i could have both individual and total area values.

Thank you in advance
--

   - Adrián Villalba Felipe.
   https://es.linkedin.com/in/adrianvillalba

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Code of Set measurements

Michael Schmid-3
Hi Adrián,

if you start with a thresholded image and you have no exclusion criteria
in "Analyze Particles" (area, circularity), you can simply check "Limit
to threshold" in "Set measurements" and use "Measure" to get the
thresholded area. "Analyze Particles" will not be needed for this step.

Otherwise you can have a short macro to sum all the areas:

   sum = 0;
   for (row=0; row<nResults; row++)
     sum = sum + getResult("Area", row);
   print(sum);

An alternative would be creating a mask with "Analyze Particles" and
measuring the foreground area (e.g. "Limit to threshold", threshold and
measure).


Michael
________________________________________________________________

On 01/06/2018 20:34, Adrián Villalba wrote:

> Dear all,
>
> I have the following piece of code which returns me a list of the area
> measuraments of my interests:
>
> run("Set Measurements...", "area centroid limit redirect=None decimal=2");
> run("Analyze Particles...", "display add");
>
>
> In consequence, i could have a list of hundreds of area values (this is my
> expected outcome) but then i would like if there is a form to have a final
> row with sum of all individual areas.
>
> I know i can do it manually with R or other software but i think it will be
> easier if i could have both individual and total area values.
>
> Thank you in advance
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html