Abstraction of an eye tracker device, virtual base class. More...
#include <Psycho/EyeTracker.H>
Public Member Functions | |
virtual Point2D< int > | getCalibEyePos () |
get the current calibrated eye position | |
virtual void | requestQuickEyeS () |
save a direct eyeS file using online calib | |
virtual void | setCurrentStimFile (std::string filename) |
virtual std::string | getCurrentStimFile () |
Constructors and Destructors | |
EyeTracker (OptionManager &mgr, const std::string &descrName="Eye Tracker", const std::string &tagName="EyeTracker") | |
Constructor. | |
virtual | ~EyeTracker () |
destructor | |
virtual void | setEventLog (nub::soft_ref< EventLog > elog) |
Set an EventLog to use to keep a trace of what happens. | |
Eye-tracker control functions | |
virtual void | calibrate (nub::soft_ref< PsychoDisplay > d) |
Calibrate the tracker, full calibration. | |
virtual void | recalibrate (nub::soft_ref< PsychoDisplay > d, int repeats=5) |
Calibrate the tracker, quick re-calibration. | |
virtual void | setBackgroundColor (nub::soft_ref< PsychoDisplay > d) |
virtual void | manualDriftCorrection (Point2D< double > eyepos, Point2D< double > targetpos) |
virtual void | calibrateOnline (nub::soft_ref< PsychoDisplay > d) |
Run online calibration routine if available on the eyetracker. | |
virtual void | closeSDL () |
virtual void | openSDL () |
virtual void | track (const bool startstop) |
Start/stop tracking depending on a boolean parameter. | |
virtual bool | isTracking () const |
Are we tracking? | |
virtual int | getSession () const |
Get current eye-tracking session number. | |
virtual CalibrationTransform::Data | getCalibrationSet (nub::soft_ref< PsychoDisplay > d) const =0 |
Get the calibration set. | |
Eye-tracker monitoring functions | |
virtual bool | isFixating ()=0 |
Has the eye-tracker detected that the subject is fixating? | |
virtual bool | isSaccade ()=0 |
virtual void | clearEyeStatus () |
Clear previosly triggered fixations and saccades. | |
Eye position data streaming functions | |
virtual Point2D< int > | getEyePos () const =0 |
Get current eye position. | |
virtual Point2D< int > | getFixationPos () const =0 |
Get current fixation position (eliminates blink, saccade, etc.). | |
Protected Member Functions | |
virtual void | startTracking ()=0 |
Start tracking. | |
virtual void | stopTracking ()=0 |
Stop tracking. | |
void | start1 () |
get started | |
Protected Attributes | |
nub::soft_ref< EventLog > | itsEventLog |
log stuff if desired |
Abstraction of an eye tracker device, virtual base class.
This class specifies the common interface to all EyeTracker derivatives and provides a number of shared basic functions. This class cannot be instantiated directly since it contains some pure virtual methods. Instead, instantiate one of the EyeTrackerXXX objects which derive from the present EyeTracker common base.
Definition at line 56 of file EyeTracker.H.
EyeTracker::EyeTracker | ( | OptionManager & | mgr, | |
const std::string & | descrName = "Eye Tracker" , |
|||
const std::string & | tagName = "EyeTracker" | |||
) |
Constructor.
Definition at line 46 of file EyeTracker.C.
EyeTracker::~EyeTracker | ( | ) | [virtual] |
destructor
Definition at line 53 of file EyeTracker.C.
void EyeTracker::calibrate | ( | nub::soft_ref< PsychoDisplay > | d | ) | [virtual] |
Calibrate the tracker, full calibration.
This function will use the provided PsychoDisplay to display calibration images and wait for user input. Default implementation is to do nothing.
Reimplemented in EyeTrackerEyeLink, and EyeTrackerISCAN.
Definition at line 72 of file EyeTracker.C.
void EyeTracker::calibrateOnline | ( | nub::soft_ref< PsychoDisplay > | d | ) | [virtual] |
Run online calibration routine if available on the eyetracker.
Reimplemented in EyeTrackerISCAN.
Definition at line 97 of file EyeTracker.C.
void EyeTracker::clearEyeStatus | ( | ) | [virtual] |
Clear previosly triggered fixations and saccades.
Clear all our eye status flags so that isFixating and isSaccade will not evaluate to true because of a previosly triggered but unchecked for fixation or saccde. Default behavior is to loop over isFixating and isSaccade, gobbling up any extra fixations. Depending on hardware, some eye trackers may have different requirements.
Reimplemented in EyeTrackerUDP.
Definition at line 153 of file EyeTracker.C.
References isFixating(), and isSaccade().
void EyeTracker::closeSDL | ( | ) | [virtual] |
Close SDL from EyeLink library. This function is designed when using EyeLink eye tracker. Ignore the function when using other eye tracker. The purpose of opening and closing SDL from EyeLink library is to take back full control of SDL from our own code. Therefore, movies can be played smoothly (no slow frames).
Reimplemented in EyeTrackerEyeLink.
Definition at line 103 of file EyeTracker.C.
Point2D< int > EyeTracker::getCalibEyePos | ( | ) | [virtual] |
get the current calibrated eye position
Reimplemented in EyeTrackerISCAN.
Definition at line 160 of file EyeTracker.C.
virtual CalibrationTransform::Data EyeTracker::getCalibrationSet | ( | nub::soft_ref< PsychoDisplay > | d | ) | const [pure virtual] |
Get the calibration set.
Implemented in EyeTrackerDML, EyeTrackerEyeLink, EyeTrackerISCAN, EyeTrackerStub, EyeTrackerTIL, and EyeTrackerUDP.
virtual Point2D<int> EyeTracker::getEyePos | ( | ) | const [pure virtual] |
Get current eye position.
Note: not all trackers support this!
Implemented in EyeTrackerDML, EyeTrackerEyeLink, EyeTrackerISCAN, EyeTrackerStub, EyeTrackerTIL, and EyeTrackerUDP.
virtual Point2D<int> EyeTracker::getFixationPos | ( | ) | const [pure virtual] |
Get current fixation position (eliminates blink, saccade, etc.).
Note: not all trackers support this!
Implemented in EyeTrackerDML, EyeTrackerEyeLink, EyeTrackerISCAN, EyeTrackerStub, EyeTrackerTIL, and EyeTrackerUDP.
int EyeTracker::getSession | ( | ) | const [virtual] |
Get current eye-tracking session number.
Definition at line 68 of file EyeTracker.C.
Referenced by EyeTrackerEyeLink::startTracking(), EyeTrackerDML::startTracking(), and EyeTrackerTIL::startTracking().
virtual bool EyeTracker::isFixating | ( | ) | [pure virtual] |
Has the eye-tracker detected that the subject is fixating?
Depending on hardware, this may either rely on a built-in fixation detection in the eye-tracking device (e.g., EyeTrackerDML, EyeTrackerUDP), or on monitoring getEyePos() over time (e.g., EyeTrackerISCAN). NOTE: this should be a non-blocking call as typically callers will also want to check for alternative triggers like keypresses while polling isFixating().
Implemented in EyeTrackerDML, EyeTrackerEyeLink, EyeTrackerISCAN, EyeTrackerStub, EyeTrackerTIL, and EyeTrackerUDP.
Referenced by clearEyeStatus().
virtual bool EyeTracker::isSaccade | ( | ) | [pure virtual] |
Has the eye-tracker detected that the subject initiated a saccade?
Depending on hardware, this may either rely on a built-in saccade detection in the eye-tracking device (e.g. EyeTrackerUDP), or on monitoring getEyePos() over time. NOTE: this should be a non-blocking call as typically callers will also want to check for alternative triggers like keypresses while polling isSaccade().
Implemented in EyeTrackerDML, EyeTrackerEyeLink, EyeTrackerISCAN, EyeTrackerStub, EyeTrackerTIL, and EyeTrackerUDP.
Referenced by clearEyeStatus().
bool EyeTracker::isTracking | ( | ) | const [virtual] |
Are we tracking?
Definition at line 149 of file EyeTracker.C.
void EyeTracker::openSDL | ( | ) | [virtual] |
Open SDL from EyeLink library. This function is designed when using EyeLink eye tracker. Ignore the function when using other eye tracker. The purpose of opening and closing SDL from EyeLink library is to take back full control of SDL from our own code. Therefore, movies can be played smoothly (no slow frames).
Reimplemented in EyeTrackerEyeLink.
Definition at line 109 of file EyeTracker.C.
void EyeTracker::recalibrate | ( | nub::soft_ref< PsychoDisplay > | d, | |
int | repeats = 5 | |||
) | [virtual] |
Calibrate the tracker, quick re-calibration.
This function will use the provided PsychoDisplay to display calibration images and wait for user input. Default implementation is to do nothing.
Reimplemented in EyeTrackerEyeLink, and EyeTrackerISCAN.
Definition at line 91 of file EyeTracker.C.
void EyeTracker::requestQuickEyeS | ( | ) | [virtual] |
save a direct eyeS file using online calib
Reimplemented in EyeTrackerISCAN.
Definition at line 165 of file EyeTracker.C.
void EyeTracker::setEventLog | ( | nub::soft_ref< EventLog > | elog | ) | [virtual] |
Set an EventLog to use to keep a trace of what happens.
If an EventLog component is registered with us, we will send it lots of event messages, each time we start or stop tracking, etc.
Definition at line 57 of file EyeTracker.C.
References itsEventLog.
void EyeTracker::start1 | ( | ) | [protected, virtual] |
get started
Reimplemented from ModelComponent.
Reimplemented in EyeTrackerDML, EyeTrackerEyeLink, EyeTrackerISCAN, EyeTrackerTIL, and EyeTrackerUDP.
Definition at line 61 of file EyeTracker.C.
virtual void EyeTracker::startTracking | ( | ) | [protected, pure virtual] |
Start tracking.
Derived classes need to implement this in a hardware-dependent manner.
Implemented in EyeTrackerDML, EyeTrackerEyeLink, EyeTrackerISCAN, EyeTrackerStub, EyeTrackerTIL, and EyeTrackerUDP.
Referenced by track().
virtual void EyeTracker::stopTracking | ( | ) | [protected, pure virtual] |
Stop tracking.
Derived classes need to implement this in a hardware-dependent manner.
Implemented in EyeTrackerDML, EyeTrackerEyeLink, EyeTrackerISCAN, EyeTrackerStub, EyeTrackerTIL, and EyeTrackerUDP.
Referenced by track().
void EyeTracker::track | ( | const bool | startstop | ) | [virtual] |
Start/stop tracking depending on a boolean parameter.
If startstop is true, then StartTracking() will be called, otherwise StopTracking() will. Note that requests to start tracking will be ignored here (no call to startTracking()) if we are already tracking; idem for stopping.
Definition at line 115 of file EyeTracker.C.
References itsEventLog, sformat(), startTracking(), and stopTracking().
nub::soft_ref<EventLog> EyeTracker::itsEventLog [protected] |
log stuff if desired
Definition at line 204 of file EyeTracker.H.
Referenced by setEventLog(), EyeTrackerEyeLink::startTracking(), and track().