calculate target saccade density Syntax: AOIDensity =calcAOISacDensity( eyePos, aoiCenter, maxDist ) Inputs: eyePos: vector of complex (x+i*y) coordinates. -1-i1 to identify missing data. They are in range [ 0 ,1 ] aoiCenter: coordinates of AOI in image scale, returned by 'returnAOICenters.m' maxDist: maximum distance to a nearest AOI, anything further considered not part of any AOI, returned by 'returnAOICenters.m' Outputs: AOIDensity: vector of number of saccades to a particular AOI
0001 % calculate target saccade density 0002 % 0003 % Syntax: AOIDensity =calcAOISacDensity( eyePos, aoiCenter, maxDist ) 0004 % 0005 % Inputs: 0006 % eyePos: vector of complex (x+i*y) coordinates. -1-i1 to identify 0007 % missing data. They are in range [ 0 ,1 ] 0008 % aoiCenter: coordinates of AOI in image scale, returned by 'returnAOICenters.m' 0009 % maxDist: maximum distance to a nearest AOI, anything further 0010 % considered not part of any AOI, returned by 'returnAOICenters.m' 0011 % 0012 % Outputs: 0013 % AOIDensity: vector of number of saccades to a particular AOI 0014 0015 function [AOIDensity ] =calcAOISacDensityDist( sacStruct, aoiCenter, maxDist ) 0016 0017 0018 endSacPos = sacStruct.endSacPos; 0019 0020 %calculate AOI fixation density 0021 numAOI = size(aoiCenter,2); 0022 numSaccades = size( endSacPos,2); 0023 AOIDensity = zeros( numAOI,1); 0024 effectivNumSaccades = 0; 0025 0026 for i1 = 1:numSaccades 0027 dist = calc2Dist( endSacPos(:,i1), aoiCenter); % 2-norm 0028 [minDist minIdx] = min( dist); 0029 if minDist < maxDist 0030 effectivNumSaccades = effectivNumSaccades+1; 0031 AOIDensity(minIdx) = AOIDensity(minIdx) + 1; 0032 end 0033 end 0034 0035 % normalize so the sum is 1 0036 if effectivNumSaccades > 0 0037 AOIDensity = AOIDensity./sum( AOIDensity); 0038 end 0039 0040