Home > GVSToolbox > 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 
0026 % % saccadeVec = sacStruct.saccadeVec;
0027 % % startSacPos = sacStruct.startSacPos;
0028 endSacPos = sacStruct.endSacPos;
0029 
0030 
0031 % % % scale eye tracks(using default value ), calculate fixations
0032 % % [ eyePos imRange] = scaleEyeTrack( eyePos,  [] );
0033 % % [ saccadeVec startSacPos endSacPos  ] = codeSaccades( eyePos);
0034 
0035 % initialize some variables
0036 numAOI = size(aoiCenter,2);
0037 numSaccades = size( endSacPos,2);
0038 AOIOrderList = zeros(numSaccades,1); 
0039 effectivNumSaccades = 0;
0040 
0041 % find AOI fixation sequence
0042 for i1 = 1:numSaccades  
0043     dist = calc2Dist( endSacPos(:,i1), aoiCenter); % 2-norm
0044     [minDist minIdx] = min( dist);    
0045     if minDist < maxDist         
0046         effectivNumSaccades = effectivNumSaccades+1;        
0047         AOIOrderList(effectivNumSaccades) = minIdx;
0048     end
0049 end
0050 
0051 % code as a matrix of indicator variables
0052 if effectivNumSaccades >0  
0053     AOISequence = zeros( numAOI, maxSaccades);     
0054     for i1 = 1:min(effectivNumSaccades, maxSaccades) 
0055         AOISequence(AOIOrderList(i1),i1) = 1; % indicator for AOI (1)
0056     end
0057     
0058 else % all 0 if no relevant AOI
0059     AOISequence = zeros( numAOI,maxSaccades);
0060 end
0061 
0062 
0063 
0064

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