Eikonix:
CEDAR
DEFINITIONS =
BEGIN
BYTE12: TYPE = [0..4096); -- NB an Eikonix byte is 12 bits
Width: CARDINAL = EikonixProtocol.Width;
Height: CARDINAL = EikonixProtocol.Height;
LineCount: TYPE = [0..Width];
PixelCount: TYPE = [0..Height];
PixelIndex: TYPE = [0..Width);
LineIndex: TYPE = [0..Height);
IntegrationTime: TYPE = CARDINAL;
NBuffer: TYPE ~ REF NBufferRecord;
NBufferRecord: TYPE ~ ARRAY PixelIndex OF BYTE12;
Handle: TYPE ~ REF HandleRecord;
HandleRecord:
TYPE ~
RECORD [
serverName: Rope.ROPE,
stream: IO.STREAM,
open: BOOL ← FALSE];
EikonixError: PUBLIC ERROR [ec: Rope.ROPE];
Open:
PUBLIC
PROC[serverName: Rope.
ROPE]
RETURNS [Handle];
Connect to and initialise the scanner
Close:
PUBLIC PROC[Handle];
Disconnect from the scanner
SelectWheel:
PUBLIC
PROC[h: Handle, color: EikonixProtocol.Color];
Rotates the color wheel
LoadNormalizer: PUBLIC PROC [h: Handle, darkCurrent: NBuffer, gain: NBuffer];
LineConsumerProc: TYPE ~
PROC [scanNumber: LineIndex, b: Buffer, clientData: REF ANY ← NIL] RETURNS [Buffer];
Buffer: TYPE ~ REF BufferRecord;
BufferRecord: TYPE ~ RECORD [pixels: SEQUENCE cnt: CARDINAL OF BYTE12];
SampleScan:
PUBLIC
PROC
[h: Handle, b: Buffer, p: LineConsumerProc, bits: EikonixProtocol.BitsPerPoint ← bp8,
clientData:
REF
ANY ←
NIL];
Performs 128 calls to p with 128 pixels accross the field. This samples every 16th pixel on every 16th scan line. The Buffer must be 128 long or a new on will be allocated.
Scan:
PUBLIC
PROC [h: Handle, lineStart: LineIndex, pixelStart: PixelIndex,
lineCount: LineCount, pixelCount: PixelCount, b: Buffer, p: LineConsumerProc,
bits: EikonixProtocol.BitsPerPoint ← bp8, clientData:
REF
ANY ←
NIL];
Scans the image starting with line lineStart pixel pixelStart for pixelCount pixels. Calls p with each line of pixels. b must be at least pixelCount long or a new b will be allocated. repCount specifies the number of times to scan and sum before sending.
SetIntegrationTime: PUBLIC PROC[h: Handle, t: IntegrationTime,
bits: EikonixProtocol.BitsPerPoint ← bp8];
GetIntegrationTime: PUBLIC PROC[h: Handle] RETURNS[t: IntegrationTime];
TurnOnLights: PUBLIC PROC [h: Handle];
TurnOffLights: PUBLIC PROC [h: Handle];
Calibrate: PUBLIC PROC
[server: Rope.ROPE ← NIL, t: IntegrationTime, color: EikonixProtocol.Color ← Clear]
RETURNS [dc, gain: Eikonix.NBuffer];
CalibrateDarkCurrent: PUBLIC PROC
[server: Rope.ROPE ← NIL, t: IntegrationTime] RETURNS [dc: Eikonix.NBuffer];
CalibrateLightsOn: PUBLIC PROC
[server: Rope.ROPE ← NIL, t: IntegrationTime, color: EikonixProtocol.Color ← Clear,
dc: Eikonix.NBuffer] RETURNS [gain: Eikonix.NBuffer];
GetCal: PUBLIC PROC [h: Handle, oldBuf: NBuffer ← NIL] RETURNS [buf: NBuffer];
ScanForMinMax: PUBLIC PROC [h: Handle, lineStart: LineIndex, pixelStart: PixelIndex,
lineCount: LineCount, pixelCount: PixelCount]
RETURNS [min: BYTE12, minScan: LineIndex, minPixel: PixelIndex,
max: BYTE12, maxScan: LineIndex, maxPixel: PixelIndex];
ComputeCorrectedCalibrate: PUBLIC PROC [dc, gain: Eikonix.NBuffer, min, max: BYTE12]
RETURNS [newDc, newGain: Eikonix.NBuffer];
END.