/////////////////////////////////////////////////////////////////////////////// // Eventhandler for Custom Defined Events // /////////////////////////////////////////////////////////////////////////////// #region CUSTOMEVENTHANDLER /// <summary> /// The <see cref="GTNetworkClient.GazeData.OnGazeData"/> event handler /// which is called whenever there is a new frame arrived. /// Sends the GazeDataChanged event to the recording module. /// </summary> /// <param name="gazeData">The <see cref="GTNetworkClient.GazeData"/> with the gaze data /// which are the mapped gaze coordinates in pixel units.</param> private void GazeData_OnGazeData(GTNetworkClient.GazeData gazeData) { this.clientStatus.IsStreaming = true; var ogamaGazeData = new GazeData { // Calculate values between 0..1 GazePosX = (float)gazeData.GazePositionX / this.presentationScreenSize.Width, GazePosY = (float)gazeData.GazePositionY / this.presentationScreenSize.Height, ////GazePosX = (float)gazeData.GazePositionX, ////GazePosY = (float)gazeData.GazePositionY, PupilDiaX = gazeData.PupilDiameterLeft, PupilDiaY = gazeData.PupilDiameterRight, Time = gazeData.TimeStamp }; this.lastGazedataString = string.Format( "Receiving gaze data: {0}Time: {1} {2} X: {3}, Y: {4} {5} Pupil: {6}", Environment.NewLine, gazeData.TimeStamp.ToString("N0"), Environment.NewLine, gazeData.GazePositionX.ToString("N0"), gazeData.GazePositionY.ToString("N0"), Environment.NewLine, gazeData.PupilDiameterLeft); if (this.shouldSendGazeSamples) { this.lastTime = gazeData.TimeStamp; this.OnGazeDataChanged(new GazeDataChangedEventArgs(ogamaGazeData)); } }
//[Test] public void TestExtractNoEyeData() { string testdata = "ET_SPL 92880206786 b 0 0 0 0 15.894208 16.633007 15.894208 16.633007 -60.177 3.029 20.306 21.726 606.911 595.593 391.127022 657.610615 417.781071 409.706189 4.24 4.27 3"; Ogama.Modules.Recording.GazeData gazeData = parseData(testdata); Assert.IsNotNull(gazeData); Assert.AreEqual(92880206786, gazeData.Time); }
public void TestExtractTrackerData() { string testdata = "ET_SPL 91555722812 b 420 420 564 564 17.219431 17.855097 17.219431 17.855097 -53.704 9.674 13.589 15.935 624.140 612.472 419.313368 680.213202 455.167761 443.716013 4.72 4.72 3"; Ogama.Modules.Recording.GazeData gazeData = parseData(testdata); Assert.IsNotNull(gazeData); Assert.AreEqual(91555722812, gazeData.Time); }
protected Ogama.Modules.Recording.GazeData parseData(string testdata) { Ogama.Modules.Recording.SMIInterface.SMISetting settings = new Ogama.Modules.Recording.SMIInterface.SMISetting(); settings.AvailableEye = Ogama.Modules.Recording.SMIInterface.AvailableEye.Both; cut.Settings = settings; Ogama.Modules.Recording.GazeData gazeData = cut.ExtractTrackerData(testdata); return(gazeData); }
/// <summary> /// OnGazeData event handler for connected tracker. /// This event fires whenever there are new gaze data /// to receive. /// It converts the interface internal gaze structure into /// a OGAMA readable format and fires the <see cref="Tracker.OnGazeDataChanged"/> /// event to the recorder. /// </summary> /// <param name="gazeData"> /// The <see cref="Recording.GazeData"/> with the new gaze data /// from the device. /// </param> public void OnGazeUpdate(TETCSharpClient.Data.GazeData gazeData) { var presentationSize = Document.ActiveDocument.PresentationSize; // Convert TheEyeTribe gaze data to ogama gaze data var newGazeData = new GazeData { Time = gazeData.TimeStamp, // Scale to 0..1 GazePosX = (float)(gazeData.RawCoordinates.X / presentationSize.Width), GazePosY = (float)(gazeData.RawCoordinates.Y / presentationSize.Height), PupilDiaX = (float)gazeData.LeftEye.PupilSize, PupilDiaY = (float)gazeData.RightEye.PupilSize }; this.OnGazeDataChanged(new GazeDataChangedEventArgs(newGazeData)); this.lastTime = newGazeData.Time; }