Home > GVSToolbox > calcAOIFixDistHistDist.m

calcAOIFixDistHistDist

PURPOSE ^

Calculate fixation density for different distances from relevant AOIs

SYNOPSIS ^

function histMatrix =calcAOIFixDistHistDist( fixStruct, aoiCenter, numBins, AOIsOfInterest, imRange )

DESCRIPTION ^

 Calculate fixation density for different distances from relevant AOIs
 
 Syntax: histMatrix =calcAOIFixDistHist( eyePos, aoiCenter, numBins, 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'
  numBins: number of bins to split up distance histogram
  AOIsOfInterest: index of AOIs which we are interested in
 
 Outputs:
  histMatrix: histogram of distances to all the AOIs, each column
       contains all fixation distance from to corresponding column of  aoiCenter. 
       The elements in column are repeated accordint time fixation time

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % Calculate fixation density for different distances from relevant AOIs
0002 %
0003 % Syntax: histMatrix =calcAOIFixDistHist( eyePos, aoiCenter, numBins, 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 %  numBins: number of bins to split up distance histogram
0010 %  AOIsOfInterest: index of AOIs which we are interested in
0011 %
0012 % Outputs:
0013 %  histMatrix: histogram of distances to all the AOIs, each column
0014 %       contains all fixation distance from to corresponding column of  aoiCenter.
0015 %       The elements in column are repeated accordint time fixation time
0016 %
0017 
0018 function histMatrix =calcAOIFixDistHistDist( fixStruct, aoiCenter, numBins, AOIsOfInterest, imRange ) 
0019 
0020 fixPosVector = fixStruct.fixPosVector;
0021 fixDurVector = fixStruct.fixDurVector;
0022 
0023 if nargin < 5 || isempty(imRange)
0024     imRange = [1024; 1280];
0025 end
0026 
0027 % % % initialize some paramters
0028 % % fixationWinSize = 6;
0029 % % fixationThreshold = 15;
0030 % %
0031 % % % scale eye tracks(using default value ), calculate fixations
0032 % % [ eyePos imRange] = scaleEyeTrack( eyePos,  [] );
0033 % % [ fixationVector P ]  = codeFixations( eyePos, fixationWinSize, fixationThreshold );
0034 
0035 
0036 % initialize some things
0037 numAOI = size(aoiCenter,2);
0038 numFixation = size( fixPosVector,2);
0039 distCell = cell( numFixation,1);
0040 if nargin < 4 || isempty(AOIsOfInterest)
0041     AOIsOfInterest = 1:numAOI;
0042 end
0043 if nargin < 3 || isempty(numBins)
0044     numBins = 10;
0045 end
0046 histMatrix = zeros( numBins, length(AOIsOfInterest));
0047 xHist=linspace(0, imRange(2), numBins);
0048 
0049 %calculate histogram of fixation distances
0050 k1 = 1;
0051 for i1 = AOIsOfInterest(:)'
0052     distTemp = calc2Dist( aoiCenter(:,i1), fixPosVector); % 2-norm
0053     for i2 = 1:numFixation;
0054         distCell{i2} = repmat(distTemp(i2), [fixDurVector(i2) ,1]);
0055     end
0056     distValuesTemp = cell2mat(distCell); 
0057     n = hist(  distValuesTemp, xHist);
0058     if sum(n)>0
0059         histMatrix(:,k1)= n./sum(n);
0060     end
0061     k1 = k1+1;
0062     
0063 %     % show it
0064 %     bar( xHist,histMatrix(:,k1));
0065 %     pause(.5);
0066     
0067 end
0068     
0069

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