Home > gt > GT.m

GT

PURPOSE ^

clpsaline#3

SYNOPSIS ^

function GT()

DESCRIPTION ^

 clpsaline#3    
   215    225
     235    345
     260    270
 clpsaline#1    
   35    45
     50    60
     2    12
 clpsaline#4    
   10    20
     60    80
     115    135
     140    160
     175    210
     230    245
 rhod74-10    
    2    22
     50    85
     140    160

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function GT()
0002 
0003 % clpsaline#3
0004 %   215    225
0005 %     235    345
0006 %     260    270
0007 % clpsaline#1
0008 %   35    45
0009 %     50    60
0010 %     2    12
0011 % clpsaline#4
0012 %   10    20
0013 %     60    80
0014 %     115    135
0015 %     140    160
0016 %     175    210
0017 %     230    245
0018 % rhod74-10
0019 %    2    22
0020 %     50    85
0021 %     140    160
0022 
0023 % clpapc1min10#3
0024 %     50 70 +
0025 %     maybe 71 -101
0026 %     102 115 +
0027 %     127 145 colliding with 3 cells ?
0028 %     137 146 +
0029 % clpsaline2bl#3
0030 %     005 059 .
0031 %     6 27 +
0032 %     98 118 +
0033 % clpsaline2min10#5
0034 %     145 196 ?
0035 % clpsaline2min10#6
0036 %     89 105 .
0037 %     108 165 ?
0038 clear;
0039 prefix = 'F2';
0040 firstFr = 1;
0041 lastFr = 60;    
0042 
0043 % FOR WBC DATA
0044 % path =strcat('\Research\WBC\Data\',prefix,'\GT Images\');
0045 % postfix = '.gt.png';
0046 
0047 % FOR NKT DATA
0048 path =strcat('\Research\NKT\Data\2009-04-23_control_dance_floor_observation\',prefix,'\MN\');
0049 postfix = '.mn.png';
0050 
0051 
0052 %==========================================================================
0053 
0054 try
0055     gtname = strcat('_GT-',prefix,'.mat');
0056     load (gtname);
0057     trId = tracksGT(end).Id+1;
0058 catch
0059 tracksGT = [];
0060 framesGT = [];
0061 trId = 1;
0062 end
0063 
0064 % gtFileName = strcat('GT-',prefix,'.mat');
0065 
0066 
0067 cd(path);
0068 ims= ({});
0069 im=1;
0070 for fr = firstFr: lastFr
0071    ims{im} = parseImage(path,prefix,fr,postfix); 
0072    im = im+1;
0073 end
0074 
0075 for fr = 1: lastFr
0076     framesGT(fr).Cells = [];
0077 end
0078 
0079 keepTracking = 1;
0080 keepGTing =1;
0081 
0082 fr = firstFr;
0083 im = 1;
0084 f= figure;
0085 
0086 
0087 while (keepGTing == 1)
0088     close(f);
0089     track = struct();
0090     track.Id = trId;
0091     track.Dataset = prefix;   
0092     track.Cells= [];
0093     
0094     
0095     
0096     f= figure;imshow(ims{im});hold on;
0097     set(f,'KeyPressFcn',@doNothing); 
0098     while (keepTracking ==1) && (fr <= lastFr)
0099         figure(f);imshow(ims{im});hold on;
0100         [R C] = size(ims{im});
0101         xlabel(strcat('Frame:', num2str(fr)),'FontSize',18,'Color','b');
0102         % plot existing track locations
0103         if ~isempty(track.Cells)
0104 %             plot(track.Cells(end,2), track.Cells(end,3),'o','MarkerEdgeColor','y','MarkerSize',12);
0105             text(track.Cells(end,2)+10, track.Cells(end,3),'\leftarrow','Color','y','FontSize',18);
0106         end
0107         
0108         % plot existing other already GTed tracks
0109         if ~isempty(framesGT(fr).Cells)
0110             for ce = 1: size(framesGT(fr).Cells,1)
0111                 plot(framesGT(fr).Cells(ce,2),framesGT(fr).Cells(ce,3),'o','MarkerEdgeColor','g','MarkerSize',6);
0112             end
0113         end
0114         
0115 
0116         % get user input location
0117         [col,row,mouse] = ginput(1);
0118         if (col>0)&&(col<C)&&(row>0)&&(row<R)
0119             if (mouse==1)
0120             gtCell = [fr col row];  
0121             track.Cells = [track.Cells; gtCell];                       
0122             fr = fr+1;
0123             im = im+1;            
0124             end
0125         else
0126             keepTracking = 0;
0127         end
0128 
0129     end
0130         
0131     button = questdlg('Choose an aciton:','Menu','GT next track','reGT this track','Quit GT','GT next track');
0132     close(f);
0133     f= figure;
0134     set(f,'KeyPressFcn',@kp); 
0135     switch button
0136         case 'GT next track'
0137             % select the frame
0138             tracksGT = [tracksGT; track];
0139             % add data to gtframe [display purpose]
0140             for tr = 1:size(track.Cells,1)
0141                 fr = track.Cells(tr,1);
0142                 framesGT(fr).Cells = [framesGT(fr).Cells; track.Cells(tr,:)];
0143             end
0144             fr = firstFr;
0145             im = 1;
0146             trId = trId+1;
0147             selectFrame = 0;
0148             while (selectFrame==0)
0149                 figure(f),imshow(ims{im});hold on;
0150                 xlabel(strcat('Frame:',num2str(fr)),'FontSize',18,'Color','b');
0151                 % plot existing other already GTed tracks
0152                 if ~isempty(framesGT(fr).Cells)
0153                     for ce = 1: size(framesGT(fr).Cells,1)
0154                         plot(framesGT(fr).Cells(ce,2),framesGT(fr).Cells(ce,3),'o','MarkerEdgeColor','g','MarkerSize',6);
0155                     end
0156                 end
0157                 uiwait;                 
0158             end
0159 
0160         case 'reGT this track'            
0161             keepTracking = 1;
0162             fr = firstFr;
0163             im = 1;
0164             selectFrame = 0;
0165             while (selectFrame==0)
0166                 figure(f),imshow(ims{im});hold on;
0167                 xlabel(strcat('Frame:',num2str(fr)),'FontSize',18,'Color','b');
0168                 % plot existing other already GTed tracks
0169                 if ~isempty(framesGT(fr).Cells)
0170                     for ce = 1: size(framesGT(fr).Cells,1)
0171                         plot(framesGT(fr).Cells(ce,2),framesGT(fr).Cells(ce,3),'o','MarkerEdgeColor','g','MarkerSize',6);
0172                     end
0173                 end
0174                 uiwait;                 
0175             end
0176             
0177         case 'Quit GT'            
0178             keepGTing = 0;
0179             tracksGT = [tracksGT; track];
0180             
0181     end
0182     
0183 
0184     
0185 end
0186 gtname = strcat('../','_GT-',prefix,'.mat');
0187 save (gtname, 'tracksGT', 'framesGT');
0188 cd ..
0189 close(f);
0190 
0191 
0192     function kp(src,evnt)
0193         switch evnt.Character
0194             case 'a'
0195                 if (fr>firstFr)
0196                     fr = fr-1;
0197                     im = im-1;
0198                 end
0199 
0200             case 'd'
0201                 if (fr<lastFr)
0202                     fr = fr+1;
0203                     im = im+1;
0204                 end
0205             case 's'
0206                 selectFrame = 1;
0207                 keepTracking = 1;
0208             otherwise
0209                 selectFrame = 1;
0210                 keepTracking = 1;
0211         end
0212         uiresume;
0213     end
0214 
0215 
0216     function doNothing(scr,evnt)
0217        switch evnt.Character
0218            case 'r'
0219                disp('you press r');
0220            otherwise
0221                disp('nothing happens');
0222        end
0223     end
0224 
0225     function bg = parseImage(path,prefix,fr,postfix)
0226         %     set(gcf,'Name',['Frame ' num2str(fr)]);
0227         % build frame_name
0228         if (fr) < 10
0229             frame_n = [prefix '00' num2str(fr) postfix];
0230         elseif (fr) < 100
0231             frame_n = [prefix '0' num2str(fr) postfix];
0232         else
0233             frame_n = [prefix num2str(fr) postfix];
0234         end
0235 
0236         frame_name = strcat(path,frame_n);
0237         %     disp(frame_name);
0238 
0239         % get the image
0240         bg = imread(frame_name);
0241 
0242     end
0243 
0244    
0245 
0246 
0247 end %function
0248

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