Home > GVSToolbox > calcAOIFixDurationDist.m

calcAOIFixDurationDist

PURPOSE ^

calculate fixation density at the AOIs

SYNOPSIS ^

function [ AOIDensity effectivNumFixation] = calcAOIFixDurationDist( fixStruct, aoiCenter, maxDist )

DESCRIPTION ^

 calculate fixation density at the AOIs
 
 Syntax: [ AOIDensity effectivNumFixation]  = calcAOIFixDensityDist( fixStruct, aoiCenter, maxDist )
 
 Inputs:
  fixStruct: struct returned by codeFixations
       fixStruct.fixDurVector: vector of (fx1),  for duration of fications
       fixStruct.fixPosVector: in format [ x x x ... x; 
                                                          y y y ... y]
  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 time spent at particular AOI
                        the last entry is time outside of those AOIs

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % calculate fixation density at the AOIs
0002 %
0003 % Syntax: [ AOIDensity effectivNumFixation]  = calcAOIFixDensityDist( fixStruct, aoiCenter, maxDist )
0004 %
0005 % Inputs:
0006 %  fixStruct: struct returned by codeFixations
0007 %       fixStruct.fixDurVector: vector of (fx1),  for duration of fications
0008 %       fixStruct.fixPosVector: in format [ x x x ... x;
0009 %                                                          y y y ... y]
0010 %  aoiCenter: coordinates of AOI in image scale, returned by 'returnAOICenters.m'
0011 %  maxDist: maximum distance to a nearest AOI, anything further
0012 %   considered not part of any AOI, returned by 'returnAOICenters.m'
0013 %
0014 % Outputs:
0015 %  AOIDensity: vector of number of time spent at particular AOI
0016 %                        the last entry is time outside of those AOIs
0017 
0018 
0019 function [ AOIDensity effectivNumFixation]  = calcAOIFixDurationDist( fixStruct, aoiCenter, maxDist ) 
0020 
0021 
0022 % fixationVector P
0023 fixPosVector = fixStruct.fixPosVector;
0024 fixDurVector = fixStruct.fixDurVector;
0025 
0026 % % % % initialize some paramters
0027 % % % fixationWinSize = 6;
0028 % % % fixationThreshold = 15;
0029 % % %
0030 % % % % scale eye tracks(using default value ), calculate fixations
0031 % % % [ eyePos imRange] = scaleEyeTrack( eyePos,  [] );
0032 % % % [ fixationVector P ]  = codeFixations( eyePos, fixationWinSize, fixationThreshold );
0033 
0034 
0035 %calculate AOI fixation density
0036 numAOI = size(aoiCenter,2);
0037 numFixation = size( fixPosVector,2);
0038 AOIDensity = zeros( numAOI+1,1);
0039 effectivNumFixation = 0;
0040 
0041 for i1 = 1:numFixation  
0042     dist = calc2Dist( fixPosVector(:,i1), aoiCenter); % 2-norm
0043     [minDist minIdx] = min( dist);    
0044     if minDist < maxDist 
0045         effectivNumFixation = effectivNumFixation+1;
0046         AOIDensity(minIdx) = AOIDensity(minIdx) + fixDurVector(i1);
0047     else
0048         AOIDensity( end) =  AOIDensity( end) + fixDurVector(i1);
0049     end
0050 end
0051 
0052 % % normalize so the sum is 1
0053 % if effectivNumFixation > 0
0054 %     AOIDensity = AOIDensity/sum( AOIDensity);
0055 % end
0056 
0057

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