This is a static copy of a profile reportHome
imagesci\private\imftype (1 call, 0.031 sec)
Generated 15-Mar-2007 12:01:56 using real time.
M-function in file C:\Program Files\MATLAB71\toolbox\matlab\imagesci\private\imftype.m
[Copy to new window for comparing multiple runs]
Parents (calling functions)
Function Name | Function Type | Calls |
imread | M-function | 1 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
33 | fmt_s = imformats(extension); | 1 | 0.031 s | 100.0% |  |
46 | return; | 1 | 0 s | 0% |  |
45 | format = fmt_s.ext{1}; | 1 | 0 s | 0% |  |
42 | if (tf) | 1 | 0 s | 0% |  |
40 | tf = feval(fmt_s.isa, filename... | 1 | 0 s | 0% |  |
Other lines & overhead | | | 0 s | 0% |  |
Totals | | | 0.031 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
imformats | M-function | 1 | 0 s | 0% |  |
imagesci\private\isbmp | M-function | 1 | 0 s | 0% |  |
Self time (built-ins, overhead, etc.) | | | 0.031 s | 100.0% |  |
Totals | | | 0.031 s | 100% | |
M-Lint results
No M-Lint messages.Coverage results
[ Show coverage for parent directory ]
Total lines in file | 92 |
Non-code lines (comments, blank lines) | 56 |
Code lines (lines that can run) | 36 |
Code lines that did run | 12 |
Code lines that did not run | 24 |
Coverage (did run/can run) | 33.33 % |
Function listing
time calls line
1 function format = imftype(filename)
2 %IMFTYPE Determine image file format.
3 % FORMAT = 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 % See also IMREAD, IMWRITE, IMFINFO, IMFROMATS.
12
13 % Copyright 1984-2002 The MathWorks, Inc.
14 % $Revision: 1.1.6.2 $ $Date: 2004/02/01 22:04:25 $
15
1 16 error(nargchk(1, 1, nargin, 'struct'));
17
18 % Optimization: look for a filename extension as a clue for the
19 % first format to try.
20
1 21 idx = find(filename == '.');
1 22 if (~isempty(idx))
1 23 extension = lower(filename(idx(end)+1:end));
24 else
25 extension = '';
26 end
27
28 % Try to get useful imformation from the extension.
29
1 30 if (~isempty(extension))
31
32 % Look up the extension in the file format registry.
0.03 1 33 fmt_s = imformats(extension);
34
1 35 if (~isempty(fmt_s))
36
1 37 if (~isempty(fmt_s.isa))
38
39 % Call the ISA function for this format.
1 40 tf = feval(fmt_s.isa, filename);
41
1 42 if (tf)
43
44 % The file is of that format. Return the ext field.
1 45 format = fmt_s.ext{1};
1 46 return;
47
48 end
49 end
50 end
51 end
52
53 % No useful information was found from the extension.
54
55 msg = '';
56
57 % Get all formats from the registry.
58 fmt_s = imformats;
59
60 % Look through each of the possible formats.
61 for p = 1:length(fmt_s)
62
63 % Call each ISA function until the format is found.
64 if (~isempty(fmt_s(p).isa))
65
66 tf = feval(fmt_s(p).isa, filename);
67
68 if (tf)
69
70 % The file is of that format. Return the ext field.
71 format = fmt_s(p).ext{1};
72 return
73
74 end
75
76 else
77
78 msg = ['At least one format does not have an ISA function', ...
79 ' registered. See "help imformats".'];
80
81 end
82 end
83
84 % The file was not of a recognized type.
85
86 % Issue the warning, if there is one.
87 if (~isempty(msg))
88 warning('MATLAB:imftype:missingIsaFunction', '%s', msg)
89 end
90
91 % Return empty value
92 format = '';