This is a static copy of a profile report

Home

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

Parents (calling functions)

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

Line NumberCodeCallsTotal Time% TimeTime Plot
62
imgskew=skewness([x,y]*ntheta'...
60586.719 s50.7%
51
mom = ml_bwmoment(img);
60584.596 s34.7%
60
[x,y]=find(img>0);
60581.102 s8.3%
49
img=img>0;
60580.491 s3.7%
63
if imgskew<0
60580.050 s0.4%
All other lines  0.300 s2.3%
Totals  13.258 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
skewnessfunction60586.359 s48.0%
ml_bwmomentfunction60584.386 s33.1%
Self time (built-ins, overhead, etc.)  2.513 s19.0%
Totals  13.258 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function65
Non-code lines (comments, blank lines)51
Code lines (lines that can run)14
Code lines that did run12
Code lines that did not run2
Coverage (did run/can run)85.71 %
Function listing
   time   calls  line
1 function [theta,center]=ml_bwmajorangle(img)
2 %ML_BWMAJORANGLE The major angle of the binary version of an image.
3 % THETA = ML_BWMAJORANGLE(IMG) returns the angle of the major axis of
4 % the binary version of the 2D image IMG. This means that the major
5 % angle is calculated on the binary image in which a pixel is one if and
6 % only if the corresponding pixel in IMG has value greater than 0. This
7 % function also considers skewness of the image. The unit of the THETA
8 % is radian.
9 %
10 % [THETA,CENTER] = ML_BWMAJORANGLE(...) also returns the center of the
11 % binary image.
12 %
13 % See also
14
15 % ??-???-???? Initial TINGZ T. Zhao
16 % 30-OCT-2004 Modified T. Zhao
17 % - add comments
18 % 23-Mar-2004 Modified T. Zhao
19 % - Debugged
20 % 19-Sep-2011 Modified Ivan Cao-Berg
21 % - Debugged
22 % Copyright (c) Murphy Lab, Carnegie Mellon University
23
24 % Copyright (C) 2007 Murphy Lab
25 % Carnegie Mellon University
26 %
27 % This program is free software; you can redistribute it and/or modify
28 % it under the terms of the GNU General Public License as published
29 % by the Free Software Foundation; either version 2 of the License,
30 % or (at your option) any later version.
31 %
32 % This program is distributed in the hope that it will be useful, but
33 % WITHOUT ANY WARRANTY; without even the implied warranty of
34 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
35 % General Public License for more details.
36 %
37 % You should have received a copy of the GNU General Public License
38 % along with this program; if not, write to the Free Software
39 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
40 % 02110-1301, USA.
41 %
42 % For additional information visit http://murphylab.web.cmu.edu or
43 % send email to murphy@cmu.edu
44
0.04 6058 45 if nargin < 1
46 error('Exactly 1 argument is required')
47 end
48
0.49 6058 49 img=img>0;
50
4.60 6058 51 mom = ml_bwmoment(img);
52
53 %center=[mom.cx,mom.cy];
0.05 6058 54 center(1,1)=mom.cx;
6058 55 center(1,2)=mom.cy;
56
0.02 6058 57 theta = .5 * atan((mom.mu02 - mom.mu20)/2/mom.mu11)+sign(mom.mu11)*pi/4;%+pi/2;
58
0.04 6058 59 ntheta=[cos(theta),sin(theta)];
1.10 6058 60 [x,y]=find(img>0);
61
6.72 6058 62 imgskew=skewness([x,y]*ntheta');
0.05 6058 63 if imgskew<0
0.01 3014 64 theta=theta+pi;
0.04 3014 65 end

Other subfunctions in this file are not included in this listing.