This is a static copy of a profile report

Home

strel>strel.getneighbors (73932 calls, 20.338 sec)
Generated 05-Nov-2014 07:52:51 using cpu time.
subfunction in file /usr1/opt/matlab/7.13/toolbox/images/images/strel.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
images/private/morphopfunction73932
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
366
[subs{:}] = ind2sub(size_nhood...
739329.794 s48.2%
369
offsets = bsxfun(@minus, offse...
739321.903 s9.4%
367
offsets = [subs{:}];
739321.292 s6.4%
356
if length(se) ~= 1
739321.202 s5.9%
365
subs = cell(1,num_dims);
739320.741 s3.6%
All other lines  5.407 s26.6%
Totals  20.338 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
ind2subfunction739328.752 s43.0%
Self time (built-ins, overhead, etc.)  11.586 s57.0%
Totals  20.338 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function46
Non-code lines (comments, blank lines)32
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
326 function [offsets,heights] = getneighbors(se)
327 %GETNEIGHBORS Get structuring element neighbor locations and heights.
328 % [OFFSETS,HEIGHTS] = GETNEIGHBORS(SE) returns the relative locations
329 % and corresponding heights for each of the neighbors in the
330 % structuring element object SE. OFFSETS is a P-by-N array where P is
331 % the number of neighbors in the structuring element and N is the
332 % dimensionality of the structuring element. Each row of OFFSETS
333 % contains the location of the corresponding neighbor, relative to the
334 % center of the structuring element. HEIGHTS is a P-element column
335 % vector containing the height of each structuring element neighbor.
336 %
337 % Example
338 % -------
339 % se = strel([1 0 1],[5 0 -5])
340 % [offsets,heights] = getneighbors(se)
341
342 % Testing notes
343 % Syntaxes
344 % --------
345 % [OFFSETS,HEIGHTS] = GETNEIGHBORS(SE)
346 %
347 % se: a 1-by-1 strel array
348 %
349 % offsets: a num_neighbors-by-num_dims array containing the relative
350 % offsets of each neighbor relative to the center of the
351 % neighborhood.
352 %
353 % heights: a num_neighbors-by-1 column vector of containing the height
354 % corresponding to each neighbor.
355
1.20 73932 356 if length(se) ~= 1
357 error(message('images:getneighbors:wrongType'));
358 end
359
0.46 73932 360 num_dims = ndims(se.nhood);
0.61 73932 361 idx = find(se.nhood);
0.51 73932 362 heights = se.height(idx);
0.39 73932 363 size_nhood = size(se.nhood);
0.73 73932 364 center = floor((size_nhood+1)/2);
0.74 73932 365 subs = cell(1,num_dims);
9.79 73932 366 [subs{:}] = ind2sub(size_nhood,idx);
1.29 73932 367 offsets = [subs{:}];
0.73 73932 368 offsets = reshape(offsets,length(idx),num_dims);
1.90 73932 369 offsets = bsxfun(@minus, offsets, center);
370
0.39 73932 371 end

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