DetectFixations360File.m 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. % DetectFixations360File.m
  2. %
  3. % This function detects fixations in input ARFF file.
  4. % The result is stored as a new attribute in the output file with values of
  5. % '{unassigned, fixation}'
  6. %
  7. % NOTE: It requires that the ARFF file has saccades already detected.
  8. %
  9. % input:
  10. % inputfile - ARFF file containing gaze coordinates
  11. % outputfile - ARFF file to store detected fixations
  12. % outputAtt - attribute that holds detected fixations in the output ARFF file
  13. % saccAtt - saccade attribute name
  14. % saccValue - integer value representing saccades
  15. % typeOfMotion- 1 -> eye FOV, 2 -> eye+head, 3 -> head
  16. % paramfile - (optional) txt file containing parameters for saccade detection (explanation below)
  17. %
  18. % paramfile format:
  19. % The file is indipendent of parameter ordering and letter case. Each parameter is followed by
  20. % an equal sign and then the value. The available values are below
  21. % minfixationdurus=
  22. % maxdistancedeg=
  23. % velthresholddegsec=
  24. % intersaccadicdist=
  25. % intersaccadiclength=
  26. % minConfidence=
  27. function DetectFixations360File(inputfile, outputFile, outputAtt, saccAtt, saccValue, typeOfMotion, paramfile)
  28. % load gaze coordinates from ARFF file
  29. [data, metadata, attributes, relation, comments] = LoadArff(inputfile);
  30. if (nargin < 7)
  31. params.minFixationDur = 100000;
  32. params.maxDistanceDeg = 0.35;
  33. params.velThresholdDegSec = 5;
  34. params.intersaccadicDist = 10.0;
  35. params.intersaccadicLength = 500000;
  36. params.minConfidence = 0.25;
  37. else
  38. params = LoadParams(paramfile);
  39. end
  40. res = DetectFixations360(data, metadata, attributes, saccAtt, saccValue, typeOfMotion, params);
  41. [data, attributes] = AddAttArff(data, attributes, res, outputAtt, '{unassigned,fixation}');
  42. SaveArff(outputFile, data, metadata, attributes, relation, comments);
  43. end