Eye tracking extension for Presentation®
The Extension for Presentation® allows you to control your Eye Tracker from Presentation® and to get raw sample data, fixations and saccades in real-time. The gaze data will be saved to files, as well as triggers you can send to synchronize your own events (like displaying a stimulus) with the gaze samples.
From Presentation® you can:
- start the eye tracking
- invoke the calibration
- define where to save the data files
- define own calibration
- send triggers (which will be saved synchronized to the gaze samples)
- get the gaze position
- get fixations and saccades
Need details on how to link your eye tracking interface?
or just call us
+49 (0)351-481 965 60
Source code example
The following code excerpt demonstrates how you can achieve this (communication with the eye tracker is highlighted yellow):
begin_pcl;
# create eyetracker instance - this will use the installed extension named "Eyetracker"
eye_tracker eye = new eye_tracker("Eyetracker");
# begin calibration
eye.calibrate(et_calibrate_default,0.0,0.0,0.0);
# tell the eyetracking extension where to save the data files (see programming manual for syntax details)
eye.send_string("DataFileName=c:\\vp1");
# start collecting data
eye.start_tracking();
# show images and send triggers which will be saved to file
eye.send_trigger(0);
eye.send_trigger(1);
trial2.present();
eye.send_trigger(2);
trial2.present();
eye.send_trigger(3);
trial2.present();
eye.send_trigger(4);
# tell presentation to collect position data
eye.start_data(dt_position, false);
# tell presentation to collect fixation data
eye.start_data(dt_fixation);
# you can also tell presentation to collect saccade data
# eye.start_data(dt_saccade);
# buffer for current gaze position
eye_position_data eyePos;
# buffer for current fixation position
fixation_event_data eyePos2;
# buffer for last fixation position for display
int lastX2 = 0;
int lastY2 = 0;
# start data collection loop
loop
int k = 1 # used as counter
until
response_manager.last_response() == 2
begin
# check if new position data is available
if eye.new_position_data() == 1 then
# get last position data
eyePos = eye.last_position_data();
# ... and move the square accordingly
square.set_part_x(1, int(eyePos.x()));
square.set_part_y(1, int(eyePos.y()));
square.present();
end;
# same as above for fixations...
if eye.new_fixation_events() == 1 then
eyePos2 = eye.last_fixation_event();
lastX2=int(eyePos2.x());
lastY2=int(eyePos2.y());
end;
square2.set_part_x(1, lastX2);
square2.set_part_y(1, lastY2);
square2.present();
end;
# stop eyetracking
eye.stop_tracking();
(The program moves two squares around the screen. Square 1 resembles the current gaze position and square 2 the last fixation)