This is a static copy of a profile report

Home

ml_objs2img (12115 calls, 6.179 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_objs2img.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
ml_obj2imgfunction6058
ml_obj2img2Dfunction6057
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
79
img(sub2ind(imgsize,objects{i}...
60571.342 s21.7%
86
img(sub2ind(imgsize,objects{i}...
60581.332 s21.6%
62
objects{i}(:,1:2) = round(obje...
121150.971 s15.7%
66
invalidpixels=ml_objinimg2D(ob...
121150.951 s15.4%
54
img=zeros(imgsize);
121150.391 s6.3%
All other lines  1.192 s19.3%
Totals  6.179 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
sub2indfunction121152.243 s36.3%
ml_objinimg2Dfunction121150.761 s12.3%
Self time (built-ins, overhead, etc.)  3.174 s51.4%
Totals  6.179 s100% 
Code Analyzer results
Line numberMessage
69The first argument of WARNING should be a message identifier. Using a message identifier allows users better control over the message.
Coverage results
[ Show coverage for parent directory ]
Total lines in function107
Non-code lines (comments, blank lines)63
Code lines (lines that can run)44
Code lines that did run16
Code lines that did not run28
Coverage (did run/can run)36.36 %
Function listing
   time   calls  line
1 function img=ml_objs2img(objects,imgsize,mode)
2 %ML_OBJS2IMG Convert objects to an image.
3 % IMG = ML_OBJS2IMG(OBJECTS,IMGSIZE) returns a 2D image with the size
4 % IMGSIZE. IMG contains all objects in the cell array OBJECTS except
5 % points outside of the image.
6 %
7 % IMG = ML_OBJS2IMG(OBJECTS,IMGSIZE,{MODE1,MODE2}) also specify the
8 % mode of image synthesis:
9 % MODE1:
10 % '2d' - 2D image
11 % '3d' - 3D image
12 % MODE2:
13 % 'og' - original pixel values in the objects
14 % 'bn' - binary image
15 % 'sg' - increasing gray leves for objects
16
17 % 18-Sep-2005 Initial write T. Zhao
18 % ??-???-2004 Initial write T. Zhao
19 % 05-NOV-2004 Modified T. Zhao
20 % - change funciton name tz_obj2img --> tz_objs2img
21
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.08 12115 45 if nargin < 2
46 error('2 or 3 arguments are required')
47 end
48
0.21 12115 49 if ~exist('mode','var')
50 mode{1}='2d';
51 mode{2}='og';
52 end
53
0.39 12115 54 img=zeros(imgsize);
55
0.10 12115 56 for i=1:length(objects)
57 %begin{26-JAN-2006}
58 %t-
59 %objects{i} = round(objects{i});
60 %t--
61 %t+
0.97 12115 62 objects{i}(:,1:2) = round(objects{i}(:,1:2));
63 %t++
64 %end{26-JAN-2006}
65
0.95 12115 66 invalidpixels=ml_objinimg2D(objects{i},imgsize);
67
0.03 12115 68 if ~isempty(invalidpixels)
69 warning('the object is located out of the image range');
70 objects{i}(invalidpixels,:)=[];
71 end
72
0.19 12115 73 switch mode{1}
0.03 12115 74 case '2d'
0.13 12115 75 switch mode{2}
0.03 12115 76 case 'og'
77
0.06 6057 78 if size(objects{i},2)<3
1.34 6057 79 img(sub2ind(imgsize,objects{i}(:,1),objects{i}(:,2)))=1;
80 %img((double(objects{i}(:,2))-1)*imgsize(1)+double(objects{i}(:,1)))=1;
81 else
82 img(sub2ind(imgsize,objects{i}(:,1),objects{i}(:,2)))=objects{i}(:,3);
83 %img((double(objects{i}(:,2))-1)*imgsize(1)+double(objects{i}(:,1)))=
84 end
0.08 6058 85 case 'bn'
1.33 6058 86 img(sub2ind(imgsize,objects{i}(:,1),objects{i}(:,2)))=1;
87 case 'sg'
88 img(sub2ind(imgsize,objects{i}(:,1),objects{i}(:,2)))=i+50;
89 end
90 case '3d'
91 switch mode{2}
92 case 'og'
93
94 if size(objects{i},2)<4
95 img(sub2ind(imgsize,objects{i}(:,1),objects{i}(:,2),objects{i}(:,3)))=1;
96 %img((double(objects{i}(:,2))-1)*imgsize(1)+double(objects{i}(:,1)))=1;
97 else
98 img(sub2ind(imgsize,objects{i}(:,1),objects{i}(:,2),objects{i}(:,3)))=objects{i}(:,4);
99 %img((double(objects{i}(:,2))-1)*imgsize(1)+double(objects{i}(:,1)))=
100 end
101 case 'bn'
102 img(sub2ind(imgsize,objects{i}(:,1),objects{i}(:,2),objects{i}(:,3)))=1;
103 case 'sg'
104 img(sub2ind(imgsize,objects{i}(:,1),objects{i}(:,2),objects{i}(:,3)))=i+50;
105 end
106 end
0.03 12115 107 end

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