Hi Georg,
A STF is a collection of histogram transformations. The easiest (and fastest) way to apply it is by creating and executing an instance of the standard HistogramTransformation process. Omitting required #includes:
function ApplySTF( img, stf )
{
var HT = new HistogramTransformation;
HT.H = [[stf[0][1], stf[0][0], stf[0][2], stf[0][3], stf[0][4]],
[stf[1][1], stf[1][0], stf[1][2], stf[1][3], stf[1][4]],
[stf[2][1], stf[2][0], stf[2][2], stf[2][3], stf[2][4]],
[ 0, 0.5, 1, 0, 1]];
var wtmp = new ImageWindow( 1, 1, 1,
img.bitsPerSample, img.sampleType == SampleType_Real, img.colorSpace != ColorSpace_Gray );
var v = wtmp.mainView;
v.beginProcess( UndoFlag_NoSwapFile );
v.image.assign( img );
v.endProcess();
HT.executeOn( v, false ); // no swap file
img.assign( v.image );
wtmp.forceClose();
}
and this function can be called in this way:
var img = new Image( ...
ApplySTF( img, ImageWindow.activeWindow.currentView.stf );
Let me know if this helps. Of course, if you don't want to use a temporary ImageWindow object, the histogram transformations can be implemented with pure JavaScript code, but that's a bit slow...