This is a static copy of a profile report

Home

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

Parents (calling functions)

Function NameFunction TypeCalls
tp_nucimgfeatfunction202
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
43
mom = ml_moment2(img);
2020.220 s48.9%
59
imgskew=ml_wmoment([x,y]*nthet...
2020.130 s28.9%
54
[x,y]=find(img>0);
2020.050 s11.1%
44
weights=img(find(img>0));
2020.040 s8.9%
64
end
2020 s0%
All other lines  0.010 s2.2%
Totals  0.451 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
ml_moment2function2020.190 s42.2%
ml_wmomentfunction2020.110 s24.4%
Self time (built-ins, overhead, etc.)  0.150 s33.3%
Totals  0.451 s100% 
Code Analyzer results
Line numberMessage
38The value assigned to variable 'theta' might be unused.
39The first argument of WARNING should be a message identifier. Using a message identifier allows users better control over the message.
44To improve performance, use logical indexing instead of FIND.
46The value assigned to variable 'center' might be unused.
Coverage results
[ Show coverage for parent directory ]
Total lines in function64
Non-code lines (comments, blank lines)44
Code lines (lines that can run)20
Code lines that did run16
Code lines that did not run4
Coverage (did run/can run)80.00 %
Function listing
   time   calls  line
1 function theta=ml_majorangle(img)
2
3 %ML_MAJORANGLE calculates the major angle an image.
4 % THETA=ML_MAJORANGLE(IMG) returns the major angle of
5 % IMG with the unit radius. The angle is calculated
6 % as the couter clockwise angle between x axis and
7 % the major axis. In the coodinate system using here,
8 % x and y are row and column repectively.
9
10 % Copyright (C) 2006 Murphy Lab
11 % Carnegie Mellon University
12 %
13 % This program is free software; you can redistribute it and/or modify
14 % it under the terms of the GNU General Public License as published
15 % by the Free Software Foundation; either version 2 of the License,
16 % or (at your option) any later version.
17 %
18 % This program is distributed in the hope that it will be useful, but
19 % WITHOUT ANY WARRANTY; without even the implied warranty of
20 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 % General Public License for more details.
22 %
23 % You should have received a copy of the GNU General Public License
24 % along with this program; if not, write to the Free Software
25 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 % 02110-1301, USA.
27 %
28 % For additional information visit http://murphylab.web.cmu.edu or
29 % send email to murphy@cmu.edu
30
31 % 01-NOV-2004 Modified T. Zhao
32 % 24-Mar-2005 Modified T. Zhao
33 % - debugged
34 % 21-Feb-2006 Modified T. Zhao
35 % - consider zero mu11
36
202 37 if min(img(:))==max(img(:))
38 theta=0;
39 warning('constant image');
40 end
41
42 %Calculate necessary moments
0.22 202 43 mom = ml_moment2(img);
0.04 202 44 weights=img(find(img>0));
45
202 46 center=[mom.cx,mom.cy];
47
202 48 if mom.mu11==0
49 theta = 0;
202 50 else
202 51 theta = .5 * atan((mom.mu02 - mom.mu20)/2/mom.mu11)+sign(mom.mu11)*pi/4;
52
202 53 ntheta=[cos(theta),sin(theta)];
0.05 202 54 [x,y]=find(img>0);
202 55 x=x-mom.cx;
202 56 y=y-mom.cy;
57
58 %do projection and estimate skewness
0.13 202 59 imgskew=ml_wmoment([x,y]*ntheta',weights,3);
60
202 61 if imgskew<0
95 62 theta=theta+pi;
95 63 end
202 64 end