Home > GVSToolbox > calcAOIFixDensityDist.m

calcAOIFixDensityDist

PURPOSE ^

calculate fixation density at the AOIs

SYNOPSIS ^

function [ AOIDensity effectivNumFixation] = calcAOIFixDensityDist( 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 relative time spent at particular AOI

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 relative time spent at particular AOI
0016 
0017 
0018 function [ AOIDensity effectivNumFixation]  = calcAOIFixDensityDist( fixStruct, aoiCenter, maxDist ) 
0019 
0020 
0021 % fixationVector P
0022 fixPosVector = fixStruct.fixPosVector;
0023 fixDurVector = fixStruct.fixDurVector;
0024 
0025 % % % % initialize some paramters
0026 % % % fixationWinSize = 6;
0027 % % % fixationThreshold = 15;
0028 % % %
0029 % % % % scale eye tracks(using default value ), calculate fixations
0030 % % % [ eyePos imRange] = scaleEyeTrack( eyePos,  [] );
0031 % % % [ fixationVector P ]  = codeFixations( eyePos, fixationWinSize, fixationThreshold );
0032 
0033 
0034 %calculate AOI fixation density
0035 numAOI = size(aoiCenter,2);
0036 numFixation = size( fixPosVector,2);
0037 AOIDensity = zeros( numAOI,1);
0038 effectivNumFixation = 0;
0039 
0040 for i1 = 1:numFixation  
0041     dist = calc2Dist( fixPosVector(:,i1), aoiCenter); % 2-norm
0042     [minDist minIdx] = min( dist);    
0043     if minDist < maxDist 
0044         effectivNumFixation = effectivNumFixation+1;
0045         AOIDensity(minIdx) = AOIDensity(minIdx) + fixDurVector(i1);
0046     end       
0047 end
0048 
0049 % normalize so the sum is 1
0050 if effectivNumFixation > 0
0051     AOIDensity = AOIDensity/sum( AOIDensity);
0052 end
0053 
0054

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