This is a static copy of a profile reportHome
ml_parsecell>updates2 (33317 calls, 15790.241 sec)
Generated 05-Nov-2014 07:52:57 using cpu time.
subfunction in file /usr0/home/jenkins/workspace/cellorganizer-demo3D11-glnx64/utilities/3D/vesicles/ml_parsecell.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
179 | pts=ml_getlinept2(s2.cellcente... | 1090080 | 6936.925 s | 43.9% |  |
206 | pts=ml_getlinept2(s2.nuccenter... | 1090440 | 6914.935 s | 43.8% |  |
213 | ps=ml_imgptspixel(s2.celledge,... | 1090440 | 377.332 s | 2.4% |  |
162 | s2.cellcontour=ml_tracecontour... | 3029 | 358.656 s | 2.3% |  |
180 | ps=ml_imgptspixel(s2.celledge,... | 1090080 | 322.616 s | 2.0% |  |
All other lines | | | 879.777 s | 5.6% |  |
Totals | | | 15790.241 s | 100% | |
Children (called functions)
Code Analyzer results
Line number | Message |
191 | Best practice is for CATCH to be followed by an identifier that gets the error information. |
241 | Best practice is for CATCH to be followed by an identifier that gets the error information. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 145 |
Non-code lines (comments, blank lines) | 22 |
Code lines (lines that can run) | 123 |
Code lines that did run | 117 |
Code lines that did not run | 6 |
Coverage (did run/can run) | 95.12 % |
Function listing
time calls line
105 function s2=updates2(s2,f)
106
0.55 33317 107 for i=1:length(f)
1.70 102977 108 if ~isfield(s2,f{i})
0.34 51491 109 switch f{i}
0.20 51491 110 case 'len'
0.06 3029 111 s2.len=sqrt(sum(s2.imgsize.^2));
0.16 48462 112 case 'cellarea'
0.02 3029 113 s2.cellarea=size(s2.cellbody,1);
0.14 45433 114 case 'nucarea'
0.02 3029 115 s2.nucarea=size(s2.nucbody,1);
0.21 42404 116 case 'cellecc'
0.06 3028 117 s2=updates2(s2,{'cellcenter'});
0.37 3028 118 cellbody(:,1:2)=ml_addrow(s2.cellbody(:,1:2),-s2.cellcenter);
0.78 3028 119 covmat=cov(cellbody(:,1),cellbody(:,2),1);
0.01 3028 120 mu20=covmat(1,1);
3028 121 mu02=covmat(2,2);
3028 122 mu11=covmat(1,2);
3028 123 mu00=size(cellbody,1);
0.05 3028 124 medresult=sqrt((mu20-mu02)^2+4*mu11^2);
3028 125 semimajor=sqrt(2*(mu20+mu02+medresult)/mu00);
0.01 3028 126 semiminor=sqrt(2*(mu20+mu02-medresult)/mu00);
0.01 3028 127 s2.cellecc=sqrt(semimajor^2-semiminor^2)/semimajor;
0.10 39376 128 case 'nucecc'
0.02 3029 129 s2=updates2(s2,{'nuccenter'});
0.24 3029 130 nucbody(:,1:2)=ml_addrow(s2.nucbody(:,1:2),-s2.nuccenter);
0.93 3029 131 covmat=cov(nucbody(:,1),nucbody(:,2),1);
3029 132 mu20=covmat(1,1);
0.01 3029 133 mu02=covmat(2,2);
3029 134 mu11=covmat(1,2);
0.02 3029 135 mu00=size(nucbody,1);
0.01 3029 136 medresult=sqrt((mu20-mu02)^2+4*mu11^2);
0.02 3029 137 semimajor=sqrt(2*(mu20+mu02+medresult)/mu00);
0.01 3029 138 semiminor=sqrt(2*(mu20+mu02-medresult)/mu00);
0.03 3029 139 s2.nucecc=sqrt(semimajor^2-semiminor^2)/semimajor;
0.09 36347 140 case 'cellimg'
2.13 3029 141 s2.cellimg=ml_obj2img(s2.cellbody,s2.imgsize,{'2d','bn'});
0.15 33318 142 case 'nucimg'
1.83 3029 143 s2.nucimg=ml_obj2img(s2.nucbody,s2.imgsize,{'2d','bn'});
0.11 30289 144 case 'celledge'
0.06 3029 145 s2=updates2(s2,{'cellimg'});
4.42 3029 146 s2.celledge=bwperim(s2.cellimg,8);
0.13 27260 147 case 'cellcenter'
0.37 3029 148 s2.cellcenter=round(mean(s2.cellbody,1));
149 %t+{27-Jan-2006}
0.03 3029 150 s2.cellcenter = s2.cellcenter(1:2);
151 %t++
0.07 24231 152 case 'nuccenter'
0.41 3029 153 s2.nuccenter=round(mean(s2.nucbody,1));
154 %t+{27-Jan-2006}
0.01 3029 155 s2.nuccenter = s2.nuccenter(1:2);
156 %t++
0.06 21202 157 case 'nucedge'
0.02 3029 158 s2=updates2(s2,{'nucimg'});
4.36 3029 159 s2.nucedge=bwperim(s2.nucimg,8);
0.05 18173 160 case 'cellcontour'
0.07 3029 161 s2=updates2(s2,{'celledge'});
358.66 3029 162 s2.cellcontour=ml_tracecontour(ml_mainobjcontour(s2.celledge));
0.05 15144 163 case 'nuccontour'
0.06 3029 164 s2=updates2(s2,{'nucedge'});
290.65 3029 165 s2.nuccontour=ml_tracecontour(ml_mainobjcontour(s2.nucedge));
0.01 12115 166 case 'cellmangle'
0.05 3029 167 s2=updates2(s2,{'cellimg'});
7.34 3029 168 s2.cellmangle=ml_bwmajorangle(s2.cellimg)*180/pi;
0.06 9086 169 case 'nucmangle'
0.03 3029 170 s2=updates2(s2,{'nucimg'});
6.05 3029 171 s2.nucmangle=ml_bwmajorangle(s2.nucimg)*180/pi;
0.04 6057 172 case {'celldist','cellhitpts'}
0.09 3028 173 s2=updates2(s2,{'cellcenter','len','celledge'});
0.03 3028 174 s2.celldist=[];
3028 175 s2.cellhitpts=[];
3028 176 da=s2.da;
0.04 3028 177 if ~isempty(s2.celledge)
0.02 3028 178 for a=0:da:360-da
6936.93 1090080 179 pts=ml_getlinept2(s2.cellcenter(1:2),a,s2.len);
322.62 1090080 180 ps=ml_imgptspixel(s2.celledge,pts);
13.82 1090080 181 intc2=find(ps>0);
182
16.29 1090080 183 if ~isempty(intc2)
16.68 1089854 184 s2.cellhitpts=[s2.cellhitpts;pts(intc2(1),:)];
23.23 1089854 185 s2.celldist=[s2.celldist, ...
186 sqrt(sum((s2.cellcenter-s2.cellhitpts(end,:)).^2))];
0.01 226 187 else
226 188 try
1.67 226 189 imshow(ml_setimglnpixel2(double(s2.celledge), ...
190 s2.cellcenter(1:2),a,s2.len),[]);
191 catch
192 end
226 193 end
8.67 1090080 194 end
3028 195 end
0.03 3029 196 case {'nucdist','nucelldist','nuchitpts','nucellhitpts'}
0.09 3029 197 s2=updates2(s2,{'nuccenter','len','nucedge','celledge'});
0.03 3029 198 s2.nucdist=[];
3029 199 s2.nucelldist=[];
0.02 3029 200 s2.nucellhitpts=[];
0.02 3029 201 s2.nuchitpts=[];
0.04 3029 202 da=s2.da;
203
0.01 3029 204 if ~isempty(s2.nucbody)
0.11 3029 205 for a=0:da:360-da
6914.93 1090440 206 pts=ml_getlinept2(s2.nuccenter(1:2),a,s2.len);
320.88 1090440 207 ps=ml_imgptspixel(s2.nucedge,pts);
10.82 1090440 208 intc1=find(ps>0);
209
6.54 1090440 210 if isempty(s2.cellbody)
211 intc2=1; %just not empty
3.44 1090440 212 else
377.33 1090440 213 ps=ml_imgptspixel(s2.celledge,pts);
10.41 1090440 214 intc2=find(ps>0);
6.37 1090440 215 end
216
21.69 1090440 217 if ~isempty(intc1) && ~isempty(intc2)
218
15.74 1059501 219 s2.nuchitpts=[s2.nuchitpts;pts(intc1(end),:)];
220
19.54 1059501 221 s2.nucdist=[s2.nucdist, ...
222 sqrt(sum((s2.nuccenter-s2.nuchitpts(end,:)).^2))];
223
6.61 1059501 224 if ~isempty(s2.cellbody)
9.84 1059501 225 s2.nucellhitpts=[s2.nucellhitpts;pts(intc2(1),:)];
15.02 1059501 226 s2.nucelldist=[s2.nucelldist, ...
227 sqrt(sum((s2.nuccenter-s2.nucellhitpts(end,:)).^2))];
6.92 1059501 228 end
229
0.07 30939 230 else
0.15 30939 231 if isempty(s2.celledge)
232 showimg=double(s2.nucedge);
0.06 30939 233 else
5.50 30939 234 showimg=double(s2.nucedge)+double(s2.celledge);
0.15 30939 235 end
0.20 30939 236 try
3.98 30939 237 if isshow
238 imshow(ml_setimglnpixel2(showimg, ...
239 s2.nuccenter(1:2),a,s2.len),[]);
240 end
241 catch
242 end
0.16 30939 243 end
244
8.66 1090440 245 end
3029 246 end
0.03 3029 247 end
0.23 51490 248 end
0.41 102976 249 end