ImageStabiliz(s)ation

The VSG Series Three has two channels of 12 bit analogue input (ADC), numbered 1 and 2. The ADCs can be read at anytime by the VSG Series Three Software and have an input range of ±5V. Values are read in the range ±5V with 12 bit precision (approximately ±3mV, number of levels is 4096: 0-4095). The analogue inputs are accessed via the BNC connectors marked ADC1 and ADC2. Note that Y (vertical) goes to ADC1 and X (horizontal) to ADC2.

From Steve's (Steven Elliott - CRS Marketing) email:

...
The vsgIOImageStabilisation function provides the same functionality as the VSG Series Three Software ImageStabilisation command. It is defined for Delphi as:
vsgIOImageStabilisation(Flag, ADCx : integer; ADCxmin, ADCxmax, SCRxmin, SCRxmax : double; ADCy : integer; ADCymin, ADCymax, SCRymin, SCRymax : double) : longint; stdcall;
The usage is the same as in the VSG Series Three Software. To turn on use:
vsgIOImageStabilisation(1, ADCXMinimumValue, ADCXMaximumValue, ScreenXMin, ScreenXMax, ADCYMinimumValue, ADCYMaximumValue, ScreenYMin, ScreenYMax);
To turn off use:
vsgIOImageStabilisation(0,0,0,0,0,0,0,0,0);
...

There are two problems in this desciption. First, the Delphi definition has 11 parameters, while the example above has 9 parameters. The other discrepancy is that in the script ADC1 and first half of parameters corresponds to y and ADC2 and second half of parameters - to x, e.g.:
cW = SCREENWIDTH/2;
cH = SCREENHEIGHT/2;
IMAGESTABILISE(1,0,4095,-cH,cH,0,4095,-cW,cW)
where cH and cW are half height and half width of the monitor in pixels.
Note that ImageStabilise does not depend on viewing distance (vd), since it takes screen dimension parameters in pixel units, not in minarcs. Therefore, we need a calibaration of this function based on vd and current calibration of the eyetacker (see Setup | Acquisition: Gain in eyetacker2.dll)
We calculate scaling coefficients stabX and stabY from the following equation (shown for x):

(1000 * 10[V]) / (60*W[deg]*stabX) = xGain[mV/minarc]

W is calculated on the basis of vd as:

W = 2*(arctan(0.5*MonW/vd)); # deg #

The actual pixel ranges (expected by the ImageStabilise function) then should be scaled by these coefficients:
(stabX = 400*stabX)
The subroutine stabcal does that as:
#----- stabcal -----#
BLOCK stabcal
stabX = 400*((1000*10)/(xGain*60*W))
stabY = 300*((1000*10)/(yGain*60*H))
ENDBLOCK
and the call to ImageStabilise function is:
IMAGESTABILISE(1,0,4095,-stabY,stabY,0,4095,stabX,-stabX)
Note: x is inverted for some obscure reason: ...stabX,-stabX...
The noise in VSG ADC causes stimuli jitter when the stabilization is on.