get latency until relevant AOI fixated Syntax: latency =calcLatencyRelAOIFix( eyePos, aoiCenter, maxDist, AOIsOfInterest ) 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: returned by 'returnAOICenters.m' AOIsOfInterest: index of AOIs which we are interested in Outputs: latency: value between 0 and length of eye track,
0001 % get latency until relevant AOI fixated 0002 % 0003 % Syntax: latency =calcLatencyRelAOIFix( eyePos, aoiCenter, maxDist, AOIsOfInterest ) 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: returned by 'returnAOICenters.m' 0010 % AOIsOfInterest: index of AOIs which we are interested in 0011 % 0012 % Outputs: 0013 % latency: value between 0 and length of eye track, 0014 % 0015 0016 function latency =calcLatencyRelAOIFixDist( fixStruct, aoiCenter, maxDist, AOIsOfInterest ) 0017 0018 0019 fixPosVector = fixStruct.fixPosVector; 0020 fixationVector = fixStruct.fixationVector; 0021 0022 numFixation = size(fixPosVector,2); 0023 numSamples = length( fixationVector ); 0024 latency = numSamples; 0025 0026 for i1 = 1:numFixation 0027 dist = calc2Dist( fixPosVector(:,i1), aoiCenter); % 2-norm 0028 [minDist minIdx] = min( dist); 0029 if minDist < maxDist && sum(minIdx == AOIsOfInterest) 0030 latency = find( fixationVector == i1 ); 0031 latency = latency(1); %/numSamples; % look at beginning of fixation 0032 break; 0033 end 0034 0035 end 0036 0037