This is a static copy of a profile report

Home

ml_imgptspixel (3270960 calls, 973.446 sec)
Generated 05-Nov-2014 07:52:53 using cpu time.
function in file /usr0/home/jenkins/workspace/cellorganizer-demo3D11-glnx64/utilities/2D/tztoolbox/ml_imgptspixel.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
ml_parsecell>updates2subfunction3270960
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
47
idx=sub2ind(imgsize,pts(:,1),p...
3270960484.961 s49.8%
38
pts(pts(:,1)<=0 | pts(:,1)&...
3270960111.374 s11.4%
39
pts(pts(:,2)<=0 | pts(:,2)&...
327096081.793 s8.4%
52
img = bwmorph( img, 'dilate', ...
3519867.143 s6.9%
51
if isempty( find(ps>0) )
327096065.320 s6.7%
All other lines  162.855 s16.7%
Totals  973.446 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
sub2indfunction3270960437.896 s45.0%
bwmorphfunction3519866.482 s6.8%
Self time (built-ins, overhead, etc.)  469.069 s48.2%
Totals  973.446 s100% 
Code Analyzer results
Line numberMessage
51To improve performance, replace ISEMPTY(FIND(X)) with ISEMPTY(FIND( X, 1 )).
Coverage results
[ Show coverage for parent directory ]
Total lines in function54
Non-code lines (comments, blank lines)38
Code lines (lines that can run)16
Code lines that did run12
Code lines that did not run4
Coverage (did run/can run)75.00 %
Function listing
   time   calls  line
1 function ps = ml_imgptspixel( img, pts )
2 %ML_IMGPTSPIXEL Get pixel values at specified points.
3 % PS = ML_IMGPTSPIXEL(IMG,PTS) returns a vector of pixel values from
4 % the image IMG. PS(I) is the gray level of the pixel at position
5 % [PTS(I,1),PTS(I,2)] in IMG.
6
7 % Ting Zhao
8 %
9 % Copyright (C) 2007-2013 Murphy Lab
10 % Carnegie Mellon University
11 %
12 % May 12, 2013 I. Cao-Berg Updated method so that if it doesn't get any
13 % hits, it will dilate the image and then try again
14 %
15 % This program is free software; you can redistribute it and/or modify
16 % it under the terms of the GNU General Public License as published
17 % by the Free Software Foundation; either version 2 of the License,
18 % or (at your option) any later version.
19 %
20 % This program is distributed in the hope that it will be useful, but
21 % WITHOUT ANY WARRANTY; without even the implied warranty of
22 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 % General Public License for more details.
24 %
25 % You should have received a copy of the GNU General Public License
26 % along with this program; if not, write to the Free Software
27 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
28 % 02110-1301, USA.
29 %
30 % For additional information visit http://murphylab.web.cmu.edu or
31 % send email to murphy@cmu.edu
32
11.94 3270960 33 if nargin < 2 || nargin > 3
34 error('Exactly 2 arguments are required')
35 end
36
29.31 3270960 37 imgsize=size(img);
111.37 3270960 38 pts(pts(:,1)<=0 | pts(:,1)>imgsize(1),:)=[];
81.79 3270960 39 pts(pts(:,2)<=0 | pts(:,2)>imgsize(2),:)=[];
40
21.97 3270960 41 if isempty(pts)
42 error('The list of points cannot be empty.');
43 end
44
17.27 3270960 45 imgsize=size(img);
46
484.96 3270960 47 idx=sub2ind(imgsize,pts(:,1),pts(:,2));
33.13 3270960 48 ps=img(idx);
49
50 %icaoberg 5/12/2013
65.32 3270960 51 if isempty( find(ps>0) )
67.14 35198 52 img = bwmorph( img, 'dilate', ones(1) );
0.33 35198 53 ps=img(idx);
0.13 35198 54 end