Skewness and Kurtosis

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

Skewness and Kurtosis

Weller Andrew Francis
Dear all,

I've been measuring both the Skewness and Kurtosis from Analyze >
Measure before I downloaded the "Moment Calculator" plugin
(http://rsb.info.nih.gov/ij/plugins/moments.html) to increase these
measurements. This now gives me significantly different results for
xSkew, ySkew, xKurt and yKurt.

Why is that? Which ones are 'correct'?

Thanks, Andy
Reply | Threaded
Open this post in threaded view
|

Moment Calculator

Andy Weller
Dear all,

I am having some problems with the Moment Calculator plugin of late. I
can run this manually and through a macro that works on one image:

run("Clear Results");
run("Moment Calculator", "  total_mass x_variance y_variance
xy_covariance x_skewness y_skewness x_kurtosis y_kurtosis elongation
cutoff=0.0000 scaling=1.0000");
mass = getResult("Mass");
xxVar = getResult("xxVar");
yyVar = getResult("yyVar");
xyVar = getResult("xyVar");
xSkew = getResult("xSkew");
ySkew = getResult("ySkew");
xKurt = getResult("xKurt");
yKurt = getResult("yKurt");
elong = getResult("Elong.");
print(mass); // This gives me a result
print(xxVar);
print(yyVar);
etc.

but as soon as I run a macro that opens and analyses several images in a
for loop, it tells me that the results table is empty. How can this be
if it has worked fine previously?

In addition, when I Analyze>Measure from with the same macro, Skewness
and Kurtosis are empty (NaN) although all other measurements seem to be
there (Area, Major, Minor, etc)?!

I suspect that this has something to do with the composite selection I
am passing to Analyze>Measure (see:
https://list.nih.gov/cgi-bin/wa?A2=ind0608&L=IMAGEJ&P=R827&I=-3&m=13711), but strange that some measurements work whilst others don't?!

Can anyone shed some light on these experiences...?

Thanks, Andy
Reply | Threaded
Open this post in threaded view
|

Re: Moment Calculator

Gabriel Landini
On Thursday 03 August 2006 17:05, Andy Weller wrote:
> but as soon as I run a macro that opens and analyses several images in a
> for loop, it tells me that the results table is empty. How can this be
> if it has worked fine previously?

This may be a timing issue. Filling the table may be happening in a different
thread. I had a similar issue with loading LUTs that would happen only in
linux.

A workaround is to insert a delay such as wait(200); before your start calling
values from the results table.

Cheers,

G.
Reply | Threaded
Open this post in threaded view
|

Re: Moment Calculator

Andy Weller
This is very odd, I just can't seem to read from the Moment Calculator
in a for loop in a macro. Even if I add a:

run("Set Measurements...", "area centroid redirect=None decimal=3");
run("Measure");

and/or a:

wait(200);

to my macro - nothing...

I've also added a row specification to my getResult():

run("Clear Results");
run("Moment Calculator", "  total_mass x_variance y_variance
xy_covariance x_skewness y_skewness x_kurtosis y_kurtosis elongation
cutoff=0.0000 scaling=1.0000");
mass = getResult("Mass", n);
xxVar = getResult("xxVar", n);
etc

where n = 0 to 5, and nothing...

Has anyone overcome similar problems?!

It is strange that it works singly but not in a for loop in a macro.

Thanks, Andy

On Thu, 2006-08-03 at 19:00 +0100, Gabriel Landini wrote:

> On Thursday 03 August 2006 17:05, Andy Weller wrote:
> > but as soon as I run a macro that opens and analyses several images in a
> > for loop, it tells me that the results table is empty. How can this be
> > if it has worked fine previously?
>
> This may be a timing issue. Filling the table may be happening in a different
> thread. I had a similar issue with loading LUTs that would happen only in
> linux.
>
> A workaround is to insert a delay such as wait(200); before your start calling
> values from the results table.
>
> Cheers,
>
> G.