Hi Jony,
The IKSS estimator is not available on the core JavaScript runtime, so you'll have to implement it in JavaScript. For your convenience, here you have it:
/*
* Iterative k-sigma Estimator of Location and Scale (IKSS).
*
* Parameters:
*
* x A Vector object with the sample values.
* eps Fractional accuracy. The default value is 1e-6.
*
* Returns an Array object of the form:
*
* [L,S,N,I]
*
* where:
*
* L is the location estimate.
* S is the scale estimate.
* N is the number of non-rejected samples used for estimation.
* I is the number of iterations performed.
*
* If the algorithm does not converge to significant values, one or both of the
* returned location and scale estimates will be zero.
*/
function IKSS( x, eps )
{
if ( eps == undefined )
eps = 1.0e-06;
x.sort();
var N = x.length;
var i = 0;
var j = N;
var s0 = 1;
for ( var it = 1; ; ++it )
{
if ( j - i < 1 )
return [0,0,0,it];
var v = new Vector( x, i, j );
var m = v.median();
var s = Math.sqrt( v.BWMV( m ) );
if ( 1 + s == 1 )
return [m,0,j-i,it];
if ( (s0 - s)/s < eps )
return [m,0.991*s,j-i,it];
s0 = s;
for ( var x0 = m - 4*s; x.at( i ) < x0; ++i ) {}
for ( var x1 = m + 4*s; x.at( j-1 ) > x1; --j ) {}
}
}
To use this function for an image, you have to gather pixel samples into a Vector object, as a result of some limitations in the Math JavaScript object implemented in current versions (this will change in the next version of PixInsight, where a Vector object won't be required, so the IKSS function above will be able to work directly with an Array). For example:
function ikssOfImage( image )
{
var A = new Array;
image.getSamples( A );
return IKSS( new Vector( A ) );
}
You'll have to iterate through a set of files, loading the images, calling the above functions, and working with the results. Let me know if you also need help with this.