/// <summary> /// Checks input data from variance calculation and raises appropriate event depending on this data and the CustomfixationDetectionStreams current state /// </summary> /// <param name="gazeVariation"></param> /// <param name="timestamp"></param> private void generateFixationState(GazePoint gazeVariation, double timestamp) { //Set pointer to next fixation data bucket. CustomFixationEventArgs cpe = null; //Check gaze data variation, current state and create appropriate event. Then set the CustomfixationDetectionStreams state. if (fixationState == EFixationStreamEventType.Waiting && gazeVariation.x < xFixationThreashold && gazeVariation.y < yFixationThreashold) { cpe = new CustomFixationEventArgs(EFixationStreamEventType.Start, timestamp, gPAverage.x, gPAverage.y); fixationState = EFixationStreamEventType.Middle; } else if (fixationState == EFixationStreamEventType.Middle && gazeVariation.x > xFixationThreashold && gazeVariation.y > yFixationThreashold) { cpe = new CustomFixationEventArgs(EFixationStreamEventType.End, timestamp, gPAverage.x, gPAverage.y); fixationState = EFixationStreamEventType.Waiting; } else if (fixationState == EFixationStreamEventType.Middle) { cpe = new CustomFixationEventArgs(EFixationStreamEventType.Middle, timestamp, gPAverage.x, gPAverage.y); } //raise the event. if (cpe != null) { onFixationStateChange(cpe); } }
//Event data bucket constructor. public CustomFixationEventArgs(EFixationStreamEventType status, double timestamp, double x, double y) { Status = status; TimeStamp = timestamp; X = x; Y = y; }
/// <summary> /// Checks input data from variance calculation and raises appropriate event depending on this data and the CustomfixationDetectionStreams current state /// </summary> /// <param name="gazeVariation"></param> /// <param name="timestamp"></param> private void generateFixationState(GazePoint gazeVariation, double timestamp) { //Set pointer to next fixation data bucket. CustomFixationEventArgs cpe = null; //check where users gaze is, if it is less than yFixationScreenBoundary set yAdjustedThreashold to yFixationCutOffThreasholdWhenGazeAtTopOfScreen //To compensate for EyeX's poor accuracy when gazing near top edge of screen. double yAdjustedThreashold = gPAverage.Y < yFixationScreenBoundary && !ZoomerFixation ? yFixationCutOffThreasholdWhenGazeAtTopOfScreen : yFixationThreashold; //Check gaze data variation, current state and create appropriate event. Then set the CustomfixationDetectionStreams state. if (fixationState == EFixationStreamEventType.Waiting && gazeVariation.X < xFixationThreashold && gazeVariation.Y < yAdjustedThreashold) { cpe = new CustomFixationEventArgs(EFixationStreamEventType.Start, timestamp, gPAverage.X, gPAverage.Y); fixationState = EFixationStreamEventType.Middle; } else if (fixationState == EFixationStreamEventType.Middle && gazeVariation.X > xFixationThreashold && gazeVariation.Y > yAdjustedThreashold) { cpe = new CustomFixationEventArgs(EFixationStreamEventType.End, timestamp, gPAverage.X, gPAverage.Y); fixationState = EFixationStreamEventType.Waiting; } else if (fixationState == EFixationStreamEventType.Middle) { cpe = new CustomFixationEventArgs(EFixationStreamEventType.Middle, timestamp, gPAverage.X, gPAverage.Y); } //raise the event. if (cpe != null) { onFixationStateChange(cpe); } }
/// <summary> /// Reset fixation data stream to its waiting state, this solves and issue when fixations are in close proximity, by stopping the stream getting stuck in the middle stae of a fixation. /// </summary> public void ResetFixationDetectionState() { fixationState = EFixationStreamEventType.Waiting; bufferCurrentIndex = 0; bufferFullIndex = 0; xBuffer = new double[bufferSize]; yBuffer = new double[bufferSize]; Thread.Sleep(100); }
//Constructor public CustomFixationDataStream(FormsEyeXHost EyeXHost) { gazeStream = EyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered); //Create gate points event handler delegate EventHandler <GazePointEventArgs> gazeDel = new EventHandler <GazePointEventArgs>(updateGazeCoodinates); //register delegate with gaze data stream next event. gazeStream.Next += gazeDel; gPAverage = new GazePoint(); xBuffer = new double[bufferSize]; yBuffer = new double[bufferSize]; fixationState = EFixationStreamEventType.Waiting; }
//Constructor public CustomFixationDataStream(FormsEyeXHost EyeXHost) { //Calculate the amount of pixels away from the top of the screen to set cut of for top of screen threshold adjustment. yFixationScreenBoundary = Constants.PRIMARY_SCREEN.Height * (screenBoudaryCutOffPercent / 100); gazeStream = EyeXHost.CreateGazePointDataStream(GazePointDataMode.Unfiltered); //Create gate points event handler delegate EventHandler <GazePointEventArgs> gazeDel = new EventHandler <GazePointEventArgs>(updateGazeCoodinates); //register delegate with gaze data stream next event. gazeStream.Next += gazeDel; gPAverage = new GazePoint(); xBuffer = new double[bufferSize]; yBuffer = new double[bufferSize]; fixationState = EFixationStreamEventType.Waiting; ZoomerFixation = false; }