This is a static copy of a profile report

Home

imfill>parse_inputs (12118 calls, 12.027 sec)
Generated 05-Nov-2014 07:52:46 using cpu time.
subfunction in file /usr1/opt/matlab/7.13/toolbox/images/images/imfill.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
imfillfunction12118
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
174
conn = conndef(ndims(IM),'mini...
121189.002 s74.9%
206
iptcheckstrs(varargin{2}, {'ho...
121181.092 s9.1%
165
iptchecknargin(1,3,nargin,mfil...
121180.481 s4.0%
168
iptcheckinput(IM, {'numeric' '...
121180.180 s1.5%
204
if ischar(varargin{2})
121180.150 s1.2%
All other lines  1.122 s9.3%
Totals  12.027 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
conndeffunction121188.832 s73.4%
iptcheckstrsfunction121180.901 s7.5%
iptchecknarginfunction121180.150 s1.2%
iptcheckinputMEX-file121180.040 s0.3%
Self time (built-ins, overhead, etc.)  2.103 s17.5%
Totals  12.027 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function117
Non-code lines (comments, blank lines)35
Code lines (lines that can run)82
Code lines that did run22
Code lines that did not run60
Coverage (did run/can run)26.83 %
Function listing
   time   calls  line
163 function [IM,locations,conn,do_fillholes] = parse_inputs(varargin)
164
0.48 12118 165 iptchecknargin(1,3,nargin,mfilename);
166
0.14 12118 167 IM = varargin{1};
0.18 12118 168 iptcheckinput(IM, {'numeric' 'logical'}, {'nonsparse' 'real'}, ...
169 mfilename, 'I1 or BW1', 1);
170
0.03 12118 171 do_interactive = false;
0.03 12118 172 do_fillholes = false;
173
9.00 12118 174 conn = conndef(ndims(IM),'minimal');
0.04 12118 175 do_conn_check = false;
176
0.06 12118 177 locations = [];
0.07 12118 178 do_location_check = false;
179
0.10 12118 180 switch nargin
0.03 12118 181 case 1
182 if islogical(IM)
183 % IMFILL(BW1)
184 do_interactive = true;
185 else
186 % IMFILL(I1)
187 do_fillholes = true;
188 end
189
0.04 12118 190 case 2
0.09 12118 191 if islogical(IM)
192 if ischar(varargin{2})
193 % IMFILL(BW1, 'holes')
194 iptcheckstrs(varargin{2}, {'holes'}, mfilename, 'OPTION', 2);
195 do_fillholes = true;
196
197 else
198 % IMFILL(BW1, LOCATIONS)
199 locations = varargin{2};
200 do_location_check = true;
201 end
202
0.05 12118 203 else
0.15 12118 204 if ischar(varargin{2})
205 % IMFILL(I1, 'holes')
1.09 12118 206 iptcheckstrs(varargin{2}, {'holes'}, mfilename, 'OPTION', 2);
0.10 12118 207 do_fillholes = true;
208
209 else
210 % IMFILL(I1, CONN)
211 conn = varargin{2};
212 do_conn_check = true;
213 conn_position = 2;
214 do_fillholes = true;
215 end
216
0.07 12118 217 end
218
219 case 3
220 if islogical(IM)
221 if ischar(varargin{3})
222 % IMFILL(BW1,CONN,'holes')
223 iptcheckstrs(varargin{3}, {'holes'}, mfilename, 'OPTION', 3);
224 do_fillholes = true;
225 conn = varargin{2};
226 do_conn_check = true;
227 conn_position = 2;
228
229 else
230 if isequal(varargin{2}, 0)
231 % IMFILL(BW1,0,CONN)
232 do_interactive = true;
233 conn = varargin{3};
234 do_conn_check = true;
235 conn_position = 2;
236
237 else
238 % IMFILL(BW1,LOCATIONS,CONN)
239 locations = varargin{2};
240 do_location_check = true;
241 conn = varargin{3};
242 do_conn_check = true;
243 conn_position = 3;
244 end
245
246 end
247
248 else
249 % IMFILL(I1,CONN,'holes')
250 iptcheckstrs(varargin{3}, {'holes'}, mfilename, 'OPTION', 3);
251 do_fillholes = true;
252 conn = varargin{2};
253 do_conn_check = true;
254 conn_position = 2;
255 end
256 end
257
0.02 12118 258 if do_conn_check
259 iptcheckconn(conn, mfilename, 'CONN', conn_position);
260 end
261
0.04 12118 262 if do_location_check
263 iptcheckinput(locations, {'double'}, {'real' 'positive' 'integer' '2d'}, ...
264 mfilename, 'LOCATIONS', 2);
265
266 locations = check_locations(locations, size(IM));
267
0.02 12118 268 elseif do_interactive
269 locations = get_locations_interactively(IM);
270 end
271
272 % Convert to linear indices if necessary.
0.09 12118 273 if ~do_fillholes && (size(locations,2) ~= 1)
274 idx = cell(1,ndims(IM));
275 for k = 1:ndims(IM)
276 idx{k} = locations(:,k);
277 end
278 locations = sub2ind(size(IM), idx{:});
279 end

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