This is a static copy of a profile reportHome
ml_downsize (606 calls, 392.994 sec)
Generated 05-Nov-2014 07:52:38 using cpu time.
function in file /usr0/home/jenkins/workspace/cellorganizer-demo3D11-glnx64/utilities/3D/microtubules/HeLa3D/slicfiles/ml_downsize.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
preprocess | function | 606 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
81 | new = interp3(old,x,y,z, dsmet... | 417 | 379.585 s | 96.6% |  |
79 | new = interp2(old, x,y, dsmeth... | 189 | 6.509 s | 1.7% |  |
68 | [y, x, z] = ndgrid(linspace(1,... | 606 | 6.259 s | 1.6% |  |
65 | old = double(old); | 606 | 0.300 s | 0.1% |  |
85 | new = eval([c '(new);']); | 606 | 0.220 s | 0.1% |  |
All other lines | | | 0.120 s | 0.0% |  |
Totals | | | 392.994 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
interp3 | function | 417 | 379.545 s | 96.6% |  |
interp2 | function | 189 | 6.499 s | 1.7% |  |
ndgrid | function | 606 | 6.108 s | 1.6% |  |
linspace | function | 1818 | 0.090 s | 0.0% |  |
Self time (built-ins, overhead, etc.) | | | 0.751 s | 0.2% |  |
Totals | | | 392.994 s | 100% | |
Code Analyzer results
Line number | Message |
79 | The value assigned to variable 'new' might be unused. |
81 | The value assigned to variable 'new' might be unused. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 87 |
Non-code lines (comments, blank lines) | 59 |
Code lines (lines that can run) | 28 |
Code lines that did run | 23 |
Code lines that did not run | 5 |
Coverage (did run/can run) | 82.14 % |
Function listing
time calls line
1 function new = ml_downsize(old, ratio, dsmeth)
2 % FUNCTION NEW = ML_DOWNSIZE(OLD, RATIO, DSMETH)
3 % Downsize a 3D image using the downsize ratio
4 % Important note: this version just works for int ratio value. Check
5 % ml_3dimresize for real ratios
6 % old: the original image
7 % ratio: a length 3 vector, ratio(1) is the downsample ratio on x, ratio(2)
8 % for y and ratio(3) for z. All 3 dimensions will be halfed if a
9 % [2 2 2] is used as ratio
10 % dsmeth: sum ('summation',blank) or average ('average'), jnewberg 11/24/05
11 %
12 % Xiang Chen
13 % Aug 15, 2002
14 %
15 % Aug 26, 2013 G. Johnson Allow for insertion of 2D objects.
16 % Nov 4, 2013 G. Johnson Allows for more accurate downsampling.
17
18
19 % Copyright (C) 2006 Murphy Lab
20 % Carnegie Mellon University
21 %
22 % This program is free software; you can redistribute it and/or modify
23 % it under the terms of the GNU General Public License as published
24 % by the Free Software Foundation; either version 2 of the License,
25 % or (at your option) any later version.
26 %
27 % This program is distributed in the hope that it will be useful, but
28 % WITHOUT ANY WARRANTY; without even the implied warranty of
29 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30 % General Public License for more details.
31 %
32 % You should have received a copy of the GNU General Public License
33 % along with this program; if not, write to the Free Software
34 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
35 % 02110-1301, USA.
36 %
37 % For additional information visit http://murphylab.web.cmu.edu or
38 % send email to murphy@cmu.edu
39
40 %dsmeth options are
41 % 'nearest' - nearest neighbor interpolation
42 % 'linear' - linear interpolation
43 % 'spline' - spline interpolation
44 % 'cubic' - cubic interpolation as long as the data is uniformly
45 % spaced, otherwise the same as 'spline'
46
606 47 if ~exist( 'dsmeth','var')
202 48 dsmeth = 'linear';
202 49 end
50
606 51 imsize = size(old);
606 52 if length(imsize) == 2
189 53 imsize = [imsize 1];
0.01 189 54 end
55
606 56 if length(ratio) == 1
57 ratio = repmat(ratio, [1,3]);
0.02 606 58 elseif length(ratio) == 2;
189 59 ratio = [ratio 1];
189 60 end
61
606 62 c = class(old);
63
64 %conver to double to linearly interpolate
0.30 606 65 old = double(old);
66
0.01 606 67 dim = round(imsize./ratio); %% desired output dimensions rounded to nearest pixel
6.26 606 68 [y, x, z] = ndgrid(linspace(1,imsize(1),dim(1)),...
69 linspace(1,imsize(2),dim(2)),...
70 linspace(1,imsize(3),dim(3)));
71
606 72 if strcmpi(dsmeth, 'nearest')
73 y = round(y);
74 x = round(x);
75 z = round(z);
76 end
77
0.01 606 78 if ndims(old) == 2
6.51 189 79 new = interp2(old, x,y, dsmeth, 0);
417 80 else
379.59 417 81 new = interp3(old,x,y,z, dsmeth, 0);
0.02 417 82 end
83
84 %re-cast back to original class
0.22 606 85 new = eval([c '(new);']);
86
0.01 606 87 end
Other subfunctions in this file are not included in this listing.