DetectSaccades360File.m 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. % function DetectSaccades360File:
  2. %
  3. % This function detects saccades from the input file and store them in the provided
  4. % attribute of the output file. The values of the attribute in the output
  5. % file are '{unassigned, saccade}'
  6. %
  7. % input:
  8. % inputfile - ARFF file containing gaze coordinates
  9. % outputfile - ARFF file to store detected saccades
  10. % outputAtt - attribute that holds detected saccades in the output ARFF file
  11. % typeOfMotion- 1 -> eye FOV, 2 -> eye+head
  12. % paramfile - (optional) txt file containing parameters for saccade detection (explanation below)
  13. %
  14. % paramfile format:
  15. % The file is indipendent of parameter ordering and letter case. Each parameter is followed by
  16. % an equal sign and then the value. The available values are below
  17. % tolerance=
  18. % thresholdOnsetFast=
  19. % thresholdOnsetSlow=
  20. % thresholdOffset=
  21. % maxSpeed=
  22. % minDuration=
  23. % maxDuration=
  24. % velIntegrationInterv=
  25. % minConfidence=
  26. function DetectSaccades360File(inputfile, outputFile, outputAtt, typeOfMotion, paramfile)
  27. % load gaze coordinates from arff file
  28. [data, metadata, attributes, relation, comments] = LoadArff(inputfile);
  29. if (nargin < 5)
  30. params.tolerance = 0.1;
  31. params.thresholdOnsetFast = 137.5;
  32. params.thresholdOnsetSlow = 17.1875;
  33. params.thresholdOffset = 17.1875;
  34. params.maxSpeed = 1031.25;
  35. params.minDuration = 15000;
  36. params.maxDuration = 160000;
  37. params.velIntegrationInterv = 4000;
  38. params.minConfidence = 0.25;
  39. else
  40. params = LoadParams(paramfile);
  41. end
  42. res = DetectSaccades360(data, metadata, attributes, typeOfMotion, params);
  43. [data, attributes] = AddAttArff(data, attributes, res, outputAtt, '{unassigned,saccade}');
  44. SaveArff(outputFile, data, metadata, attributes, relation, comments);
  45. end