This is a static copy of a profile reportHome
tz_maskimg_3d (808 calls, 4.486 sec)
Generated 05-Nov-2014 07:52:41 using cpu time.
function in file /usr0/home/jenkins/workspace/cellorganizer-demo3D11-glnx64/utilities/3D/microtubules/HeLa3D/tz_maskimg_3d.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
preprocess | function | 808 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
51 | img2 = (maskimg>0).*img; | 782 | 4.146 s | 92.4% |  |
40 | img2 = img.*maskimg; | 26 | 0.160 s | 3.6% |  |
39 | maskimg = repmat(maskimg(:,:,u... | 26 | 0.050 s | 1.1% |  |
36 | img2 = zeros(size(img)); | 26 | 0.040 s | 0.9% |  |
52 | end | 782 | 0.020 s | 0.4% |  |
All other lines | | | 0.070 s | 1.6% |  |
Totals | | | 4.486 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
repmat | function | 26 | 0.010 s | 0.2% |  |
squeeze | function | 26 | 0.010 s | 0.2% |  |
Self time (built-ins, overhead, etc.) | | | 4.466 s | 99.6% |  |
Totals | | | 4.486 s | 100% | |
Code Analyzer results
Line number | Message |
30 | The first argument of WARNING should be a message identifier. Using a message identifier allows users better control over the message. |
36 | The value assigned to variable 'img2' might be unused. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 52 |
Non-code lines (comments, blank lines) | 40 |
Code lines (lines that can run) | 12 |
Code lines that did run | 12 |
Code lines that did not run | 0 |
Coverage (did run/can run) | 100.00 % |
Function listing
time calls line
1 function img2=tz_maskimg_3d(img,maskimg)
2 %TZ_MASKIMG_3D Crop 3D image by an mask.
3 % IMG2 = TZ_MASKIMG_3D(IMG,MASKIMG)
4 %
5 % See also
6
7 % 17-Sep-2005 Initial write T. Zhao
8 % Copyright (c) Murphy Lab, Carnegie Mellon University
9
10 %function img2=tz_maskimg_3d(img,maskimg)
11 %
12 %OVERVIEW:
13 % Creates a maskimg with the same z dimension as img and uses it to mask
14 % the original image.
15 %
16 %Edited:
17 %D. Sullivan 6/6/13 added support for 3D masks and catch/override for
18 % multiple masks being passed at once.
19 %
20 %%%%%%
21
808 22 nslice=size(img,3);
23 %D. Sulliavn 6/6/13 allow for 3D masks with the same size as the original
24 %image
808 25 if size(maskimg,3)~=nslice
26 %D. Sullivan 6/6/13 force the mask without the same number of
27 %slices to be 2D to start. otherwise take the first non-zero slice
0.01 26 28 useslice = find(squeeze(sum(sum(maskimg,1),2)),1);
26 29 if size(maskimg,3)>1
26 30 warning(['Number of mask slices>1&¬ equal to number of',...
31 'image slices Using first non-zero mask channel.',...
32 ' If multiple are cells present, please save each as a ',...
33 'separate file with its own mask.']);
26 34 end
35
0.04 26 36 img2 = zeros(size(img));
37 %D. Sullivan 6/6/13 get rid of for loop in favor of repmat for speed.
38 %make sure the mask is 0's and 1's (could have been 0,255 or something)
0.05 26 39 maskimg = repmat(maskimg(:,:,useslice),[1,1,nslice])>0;
0.16 26 40 img2 = img.*maskimg;
41 % for i=1:nslice
42 % simg=img(:,:,i);
43 % %D. Sullivan 6/6/13 handle case where maskimg has multiple slices
44 % % simg(find(maskimg==0))=0;
45 % simg(find(maskimg(:,:,useslice)==0))=0;
46 % img2(:,:,i)=simg;
47 % end
782 48 else
49 %D. Sullivan 6/6/13 again, no need for a for loop
50 %make sure the mask is 0's and 1's (could have been 0,255 or something)
4.15 782 51 img2 = (maskimg>0).*img;
0.02 782 52 end
Other subfunctions in this file are not included in this listing.