-
Notifications
You must be signed in to change notification settings - Fork 7
UxLabClassWebApp CSV mapping
martinkonopka edited this page Mar 9, 2018
·
4 revisions
UXI.GazeToolkit accepts JSON array of GazeData objects. To convert old UxLabClassWebApp CSV format into JSON array, follow this mapping guideline.
Example of data in UxLabClassWebApp CSV format.
TimeStamp;LeftEyePosition3D-X;LeftEyePosition3D-Y;LeftEyePosition3D-Z;LeftEyePosition3DRelative-X;LeftEyePosition3DRelative-Y;LeftEyePosition3DRelative-Z;LeftGazePoint2D-X;LeftGazePoint2D-Y;LeftGazePoint2Dsmooth-X;LeftGazePoint2Dsmooth-Y;LeftGazePoint3D-X;LeftGazePoint3D-Y;LeftGazePoint3D-Z;LeftPupilSize;LeftValidity;RightEyePosition3D-X;RightEyePosition3D-Y;RightEyePosition3D-Z;RightEyePosition3DRelative-X;RightEyePosition3DRelative-Y;RightEyePosition3DRelative-Z;RightGazePoint2D-X;RightGazePoint2D-Y;RightGazePoint2Dsmooth-X;RightGazePoint2Dsmooth-Y;RightGazePoint3D-X;RightGazePoint3D-Y;RightGazePoint3D-Z;RightPupilSize;RightValidity;TobiiTicks
26.04.2016 10:21:30.530;-15.129;2.142;648.349;0.586;0.482;0.661;0.575;0.477;0.575;0.477;38.799;176.699;58.077;2.797;0;50.907;0.786;637.116;0.369;0.490;0.623;0.577;0.469;0.577;0.469;39.732;178.784;58.922;2.731;0;1461658865970438
In UXI.GazeToolkit GazeData
, data of individual eyes are separated into LeftEye
and RightEye
properties.
Some properties requires value conversion from the CSV format (see Converters section below).
Ignore *-smooth
fields in the CSV data.
[{
"Timestamp" : ConvertTimestamp(TimeStamp),
"TrackerTicks" : TobiiTicks,
"Validity" : ConvertValidity(LeftValidity, RightValidity),
"LeftEye" : {
"Validity" : ConvertEyeValidity(LeftValidity),
"GazePoint2D" : {
"X" : LeftGazePoint2D-X,
"Y" : LeftGazePoint2D-Y
},
"GazePoint3D" : {
"X" : LeftGazePoint3D-X,
"Y" : LeftGazePoint3D-Y,
"Z" : LeftGazePoint3D-Z,
},
"EyePosition3D" : {
X, Y, Z : LeftEyePosition3D-X, -Y, -Z
},
"EyePosition3DRelative" : {
X, Y, Z : LeftEyePosition3DRelative-X, -Y, -Z
},
"PupilDiameter" : LeftPupilSize
},
"RightEye" : { ... }
}, ... ]
Converters needed to convert data from CSV format.
Extract time from the DateTime timestamp in CSV:
ConvertTimestamp :
CSV::TimeStamp -> JSON::Timestamp
"26.04.2016 10:21:30.530" -> "10:21:30.530"
Create validity string for both eyes from numeric validity codes for individual eyes.
ConvertValidity :
CSV::LeftValidity x CSV::RightValidity -> JSON::Validity
0 x 0 -> "Both"
0 x 4 -> "Left"
1 x 3 -> "ProbablyLeft"
2 x 2 -> "UnknownWhichOne"
3 x 1 -> "ProbablyRight"
4 x 0 -> "Right"
4 x 4 / else -> "None"
Convert numeric single eye validity code to string representation.
ConvertEyeValidity :
CSV::LeftValidity -> JSON::LeftEye.Validity
CSV::RightValidity -> JSON::RightEye.Validity
0 -> "Valid"
1 -> "Probably"
2 -> "Unknown"
4 / else -> "Invalid"
Output for the sample CSV input above.
[
{
"Timestamp": "10:21:30.530",
"TrackerTicks": 1461658865970438,
"Validity": "Both",
"LeftEye": {
"Validity": "Valid",
"GazePoint2D": {
"X": 0.575,
"Y": 0.477
},
"GazePoint3D": {
"X": 38.799,
"Y": 176.699,
"Z": 58.077
},
"EyePosition3D": {
"X": -15.129,
"Y": 2.142,
"Z": 648.349
},
"EyePosition3DRelative": {
"X": 0.586,
"Y": 0.482,
"Z": 0.661
},
"PupilDiameter": 2.797
},
"RightEye": {
"Validity": "Valid",
"GazePoint2D": {
"X": 0.577,
"Y": 0.469
},
"GazePoint3D": {
"X": 39.732,
"Y": 178.784,
"Z": 58.922
},
"EyePosition3D": {
"X": 50.907,
"Y": 0.786,
"Z": 637.116
},
"EyePosition3DRelative": {
"X": 0.369,
"Y": 0.490,
"Z": 0.623
},
"PupilDiameter": 2.731
}
},
...
]