This shows you the differences between two versions of the page.
mgl:taskreferenceeyetracking [2010/03/26 16:15] |
mgl:taskreferenceeyetracking [2022/08/30 13:40] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Integrating eye tracking with a task ====== | ||
+ | |||
+ | |||
+ | There is a generic interface to the eye tracking functionality. As long as the appropriate callback functions are written for an eye tracker, no code needs to be changed in your task. | ||
+ | |||
+ | To configure MGL to use an eye tracker you must initialize the eye tracker support. The eye tracker configuration is specified in the eyetracker field of myscreen. | ||
+ | |||
+ | You should start by specifying whether to save the data (in a file) and what data you need. | ||
+ | <code matlab> | ||
+ | myscreen.eyetracker.savedata = true; | ||
+ | myscreen.eyetracker.data = [1 1 1 0]; % don't need link events | ||
+ | </code> | ||
+ | |||
+ | You also need to specify one of your tasks (or which of your phases) you want to use to control the eye data timing. This task will define what is a block, trial, etc. | ||
+ | <code matlab> | ||
+ | task{1}.collectEyeData = true; | ||
+ | </code> | ||
+ | |||
+ | Next you initialize MGL's eye tracker support for your eye tracker. | ||
+ | <code> | ||
+ | myscreen = initEyeTracker(myscreen, 'Eyelink'); | ||
+ | </code> | ||
+ | |||
+ | And finally you need to run a calibration. | ||
+ | <code matlab> | ||
+ | myscreen = calibrateEyeTracker(myscreen); | ||
+ | </code> | ||