Home > analysis > get_feature_score_by_position.m

get_feature_score_by_position

PURPOSE ^

get feature score of cell position

SYNOPSIS ^

function fVal = get_feature_score_by_position(positionMatrix,featureType)

DESCRIPTION ^

 get feature score of cell position
 INPUT
   positionMatrix   - N X 5 matrix
                    - seq | frame | id | col | row
   featureType      - type of feature
                    - TD RM DT ect.

 OUTPUT
   fVal             - feature score Vector
 
 EXAMPLE
   fVal   = get_feature_score_by_position(FN,'TD');

 Written by Rich Nguyen
 Version 1.0 July 2010

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function fVal = get_feature_score_by_position(positionMatrix,featureType)
0002 % get feature score of cell position
0003 % INPUT
0004 %   positionMatrix   - N X 5 matrix
0005 %                    - seq | frame | id | col | row
0006 %   featureType      - type of feature
0007 %                    - TD RM DT ect.
0008 %
0009 % OUTPUT
0010 %   fVal             - feature score Vector
0011 %
0012 % EXAMPLE
0013 %   fVal   = get_feature_score_by_position(FN,'TD');
0014 %
0015 % Written by Rich Nguyen
0016 % Version 1.0 July 2010
0017 
0018 %% INIT
0019 P = initParam('wbc');
0020 fVal = zeros(size(positionMatrix,1),1);
0021 fid = 1;
0022 %% CHECK INPUT
0023 if size(positionMatrix,2) ~= 5
0024     error('Position Matrix should be N X 5');
0025 end
0026 
0027 %% PROCESSING
0028 for seq = 1: length(P.IFOLDERS)
0029     fprintf('\nAnalyzing at sequence %s', P.IFOLDERS(seq).Name);
0030     positionPerSeq = positionMatrix(positionMatrix(:,1)==seq,:);
0031     frs =  unique(positionPerSeq(:,2));
0032     
0033     for frId  = 1: length(frs)
0034         fr = frs(frId);
0035         
0036         % Read in the feature image
0037         imName  = strcat(P.IFOLDERS(seq).Name,'/',featureType, '/',...
0038             featureType, '_', P.IFOLDERS(seq).Name,num2str(fr),'.png');
0039         im = imread(imName);
0040         
0041         positionPerFrame = positionPerSeq(positionPerSeq(:,2)==fr,:);
0042         for id = 1 : size(positionPerFrame,1)
0043             position = positionPerFrame(id,:);
0044             fVal(fid) = im(position(5), position(4) );
0045             fid = fid + 1;
0046         end
0047         
0048     
0049     end
0050 end
0051 
0052 
0053 
0054 
0055 
0056 
0057 end

Generated on Thu 17-Mar-2011 14:45:51 by m2html © 2005