abs, acos, asin, atan, atof, atoi, cos, fabs, hypot, log, max, min, pow, random, rng, round, sgn, sin, SortArrayDbl, SortArrayInt, sqrt, tan, UpdateMeanAndVariance
Number of objects (n).
Mean equivalent diameter (MeanEqDia) for n objects.
Variance of equivalent diameter (VarEqDia) for n objects.
Description
SortArrayDbl( double *Int_ArrayDbl
, longInt_Count
);
This function can sort an array of double values. The sorting is ascending.
Int_Count parameter is the position of the desired value (0 for the first position).
double data[1000]; int size; double median; char text[64]; ScanObjects(); size = Get_NumObjects(FIELD_LAST, 0); if (size>0) { Get_ObjectFeatureData("Area", data, FIELD_LAST, 0); SortArrayDbl(data, size); median = data[size/2]; sprintf(text, "Median is: %f","median"); WaitText(3, text); }
See Also
SortArrayInt
Description
SortArrayInt( int *Int_ArrayInt
, longInt_Count
);
This function can sort an array of integer values. The sorting is ascending.
Int_Count parameter is the position of the desired value (0 for the first position).
Description
abs(
int Int_X
);
This function returns the absolute value of its integer parameter i.
Description
atof(
char *Int_Buf1
);
This function converts a character string to a double-precision floating point value.
Return Values
The atof function returns a double-precision floating point, produced by interpreting the input characters as a number. The return value is 0, if the input cannot be converted to a double. The return value is undefined in case of overflow. The function expects string to have the following form: [whitespace] [sign] [digits] [.digits] [ {d | D | e | E }[sign]digits].
Description
atoi(
char *Int_Buf1
);
This function converts a character string to an integer value.
Description
fabs(
double x
);
This function returns the absolute value of its double parameter x.
Description
hypot( doublex
, doubley
);
This function returns the hypothenuse of a triangle with sides of length x and y.
Description
log(
double Int_DX
);
This function returns the logarithm with base 10 of double parameter x.
Description
max( doubleval1
, doubleval2
);
This function compares two values and returns the value of the greater one.
Description
min( doubleval1
, doubleval2
);
This function compares two values and returns the value of the smaller one.
Description
pow( doublex
, doubley
);
This function computes x raised to the power of y.
Return Values
The function returns x raised to the y-th power. If x is not 0.0 and y is 0.0, pow returns the value 1. If x is 0.0 and y is negative, pow returns 0.0. If both x and y are 0.0, or if x is negative and y is not an integer, the function returns 0.0. If an overflow results, the function returns the maximum value to fit in a double.
Description
random(
int seed
);
This function generates random integer in the range 0 to 32767.
Parameters
Description
rng( doublex
, doubleInt_Low
, doubleInt_High
);
This function returns x if x lies between low and high inclusive, low if x is smaller than low and high if x is larger than high.
Description
round(
double x
);
This function returns double parameter x, rounded to the nearest integer.
Description
UpdateMeanAndVariance( int *Int_pTotalN
, double *Int_pTotalMean
, double *Int_pTotalVariance
, intInt_n
, doubleInt_mean
, doubleInt_variance
);
This function updates the mean variance so that it can be counted in parts.
Example:
GA3 in JOBs returns these data after every frame:
We have global variables totalN, totalMean, and totalVar in the job. They are all initialized to zeros. After each frame, we update them with this call:
UpdateMeanAndVariance(&totalN, &totalMean, &totalVar, n, MeanEqDia, VarEqDia)
Parameters