This is a static copy of a profile report

Home

imagesci/private/imftype (4 calls, 0.120 sec)
Generated 05-Aug-2011 13:01:19 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/imagesci/private/imftype.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
imfinfofunction4
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
44
fmt_s = imformats(extension);
40.077 s63.6%
77
tf = feval(fmt_s(p).isa, filen...
760.022 s18.2%
75
if (~isempty(fmt_s(p).isa))
760.011 s9.1%
69
fmt_s = imformats;
40.011 s9.1%
105
fmt_s = '';
40 s0%
All other lines  0 s0%
Totals  0.120 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
imformatsfunction80.066 s54.5%
imagesci/private/ispgmfunction40.011 s9.1%
imagesci/private/isxwdfunction40 s0%
imagesci/private/istiffunction40 s0%
imagesci/private/israsfunction40 s0%
imagesci/private/isppmfunction40 s0%
imagesci/private/ispnmfunction40 s0%
imagesci/private/ispngfunction40 s0%
imagesci/private/ispcxfunction40 s0%
imagesci/private/ispbmfunction40 s0%
imagesci/private/isjpgfunction40 s0%
imagesci/private/isjp2function120 s0%
imagesci/private/isicofunction40 s0%
imagesci/private/ishdffunction40 s0%
imagesci/private/isgiffunction40 s0%
imagesci/private/isfitsfunction40 s0%
imagesci/private/iscurfunction40 s0%
imagesci/private/isbmpfunction40 s0%
Self time (built-ins, overhead, etc.)  0.044 s36.4%
Totals  0.120 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function105
Non-code lines (comments, blank lines)67
Code lines (lines that can run)38
Code lines that did run18
Code lines that did not run20
Coverage (did run/can run)47.37 %
Function listing
   time   calls  line
1 function [format,fmt_s] = imftype(filename)
2 %IMFTYPE Determine image file format.
3 % [FORMAT,REGISTRY] = IMFTYPE(FILENAME) attempts to determine the image
4 % file format for the file FILENAME. If IMFTYPE is successful,
5 % FORMAT will be returned as the first string in the ext field
6 % of the format registry (e.g., 'jpg', 'png', etc.)
7 %
8 % FORMAT will be an empty string if IMFTYPE cannot determine
9 % the file format.
10 %
11 % REGISTRY is a structure containing all of the values in
12 % the file format registry. The fields in this structure are:
13 %
14 % ext - A cell array of file extensions for this format
15 % isa - Function to determine if a file "IS A" certain type
16 % info - Function to read information about a file
17 % read - Function to read image data a file
18 % write - Function to write MATLAB data to a file
19 % alpha - 1 if the format has an alpha channel, 0 otherwise
20 % description - A text description of the file format
21 %
22 % See also IMREAD, IMWRITE, IMFINFO, IMFORMATS.
23
24 % Copyright 1984-2007 The MathWorks, Inc.
25 % $Revision: 1.1.6.4 $ $Date: 2007/11/09 20:34:28 $
26
4 27 error(nargchk(1, 1, nargin, 'struct'));
28
29 % Optimization: look for a filename extension as a clue for the
30 % first format to try.
31
4 32 idx = find(filename == '.');
4 33 if (~isempty(idx))
4 34 extension = lower(filename(idx(end)+1:end));
35 else
36 extension = '';
37 end
38
39 % Try to get useful imformation from the extension.
40
4 41 if (~isempty(extension))
42
43 % Look up the extension in the file format registry.
0.08 4 44 fmt_s = imformats(extension);
45
4 46 if (~isempty(fmt_s))
47
48 if (~isempty(fmt_s.isa))
49
50 % Call the ISA function for this format.
51 tf = feval(fmt_s.isa, filename);
52
53 if (tf)
54
55 % The file is of that format. Return the ext field.
56 format = fmt_s.ext{1};
57 return;
58
59 end
60 end
61 end
4 62 end
63
64 % No useful information was found from the extension.
65
4 66 msg = '';
67
68 % Get all formats from the registry.
0.01 4 69 fmt_s = imformats;
70
71 % Look through each of the possible formats.
4 72 for p = 1:length(fmt_s)
73
74 % Call each ISA function until the format is found.
0.01 76 75 if (~isempty(fmt_s(p).isa))
76
0.02 76 77 tf = feval(fmt_s(p).isa, filename);
78
76 79 if (tf)
80
81 % The file is of that format. Return the ext field.
82 format = fmt_s(p).ext{1};
83 fmt_s = fmt_s(p);
84 return
85
86 end
87
88 else
89
90 msg = ['At least one format does not have an ISA function', ...
91 ' registered. See "help imformats".'];
92
93 end
76 94 end
95
96 % The file was not of a recognized type.
97
98 % Issue the warning, if there is one.
4 99 if (~isempty(msg))
100 warning('MATLAB:imftype:missingIsaFunction', '%s', msg)
101 end
102
103 % Return empty value
4 104 format = '';
4 105 fmt_s = '';