Home > src > calcAOISacSequenceDist.m

calcAOISacSequenceDist

PURPOSE ^

calculate matrix representing the sequence of AOIs saccaded to

SYNOPSIS ^

function [ AOISequence ] =calcAOISacSequenceDist( sacStruct, aoiCenter, maxDist, maxSaccades )

DESCRIPTION ^

 calculate matrix representing the sequence of AOIs saccaded to
 
 Syntax: [ AOISequence ] =calcAOISacSequence( eyePos, aoiCenter, maxDist, maxSaccades) 
 
 Inputs:
  sacStruct: returned from codeSaccadesDist
  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'
  maxSaccades: number of saccades in the sequence to keep
 
 Outputs:
  AOISequence: matrix (numAOI x numFix) with an indicator (1) for
       in each column corresponding to the AOI of interest.  If no
       AOI, it will be an all 0;

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % calculate matrix representing the sequence of AOIs saccaded to
0002 %
0003 % Syntax: [ AOISequence ] =calcAOISacSequence( eyePos, aoiCenter, maxDist, maxSaccades)
0004 %
0005 % Inputs:
0006 %  sacStruct: returned from codeSaccadesDist
0007 %  aoiCenter: coordinates of AOI in image scale, returned by 'returnAOICenters.m'
0008 %  maxDist: maximum distance to a nearest AOI, anything further
0009 %   considered not part of any AOI, returned by 'returnAOICenters.m'
0010 %  maxSaccades: number of saccades in the sequence to keep
0011 %
0012 % Outputs:
0013 %  AOISequence: matrix (numAOI x numFix) with an indicator (1) for
0014 %       in each column corresponding to the AOI of interest.  If no
0015 %       AOI, it will be an all 0;
0016 
0017 
0018 function [ AOISequence ] =calcAOISacSequenceDist( sacStruct, aoiCenter, maxDist, maxSaccades ) 
0019 
0020 % initialize some paramters
0021 if nargin < 4 || isempty( maxSaccades )
0022     maxSaccades = 3;
0023 end
0024 
0025 % initialize some variables
0026 endSacPos = sacStruct.endSacPos;
0027 numAOI = size(aoiCenter,2);
0028 numSaccades = size( endSacPos,2);
0029 AOIOrderList = zeros(numSaccades,1); 
0030 effectivNumSaccades = 0;
0031 
0032 % find AOI fixation sequence
0033 for i1 = 1:numSaccades  
0034     dist = calc2Dist( endSacPos(:,i1), aoiCenter); % 2-norm
0035     [minDist minIdx] = min( dist);    
0036     if minDist < maxDist         
0037         effectivNumSaccades = effectivNumSaccades+1;        
0038         AOIOrderList(effectivNumSaccades) = minIdx;
0039     end
0040 end
0041 
0042 % code as a matrix of indicator variables
0043 if effectivNumSaccades >0  
0044     AOISequence = zeros( numAOI, maxSaccades);     
0045     for i1 = 1:min(effectivNumSaccades, maxSaccades) 
0046         AOISequence(AOIOrderList(i1),i1) = 1; % indicator for AOI (1)
0047     end
0048     
0049 else % all 0 if no relevant AOI
0050     AOISequence = zeros( numAOI,maxSaccades);
0051 end
0052 
0053 
0054 
0055

Generated on Wed 20-Jan-2016 11:50:43 by m2html © 2005