Home > GVSToolbox > calcAOISacDensityDist.m

calcAOISacDensityDist

PURPOSE ^

calculate target saccade density

SYNOPSIS ^

function [AOIDensity ] =calcAOISacDensityDist( sacStruct, aoiCenter, maxDist )

DESCRIPTION ^

 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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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 
0019 
0020 % % saccadeVec = sacStruct.saccadeVec;
0021 % % startSacPos = sacStruct.startSacPos;
0022 endSacPos = sacStruct.endSacPos;
0023 
0024 
0025 % % % scale eye tracks(using default value ), calculate fixations
0026 % % [ eyePos imRange] = scaleEyeTrack( eyePos,  [] );
0027 % % [ saccadeVec startSacPos endSacPos  ] = codeSaccades( eyePos);
0028 
0029 %calculate AOI fixation density
0030 numAOI = size(aoiCenter,2);
0031 numSaccades = size( endSacPos,2);
0032 AOIDensity = zeros( numAOI,1);
0033 effectivNumSaccades = 0;
0034 
0035 for i1 = 1:numSaccades  
0036     dist = calc2Dist( endSacPos(:,i1), aoiCenter); % 2-norm
0037     [minDist minIdx] = min( dist);    
0038     if minDist < maxDist 
0039         effectivNumSaccades = effectivNumSaccades+1;
0040         AOIDensity(minIdx) = AOIDensity(minIdx) + 1;
0041     end       
0042 end
0043 
0044 % normalize so the sum is 1
0045 if effectivNumSaccades > 0
0046     AOIDensity = AOIDensity./sum( AOIDensity);
0047 end
0048 
0049

Generated on Tue 01-Jul-2014 12:35:04 by m2html © 2005