This is a static copy of a profile report

Home

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

Parents (calling functions)

Function NameFunction TypeCalls
imagesci/private/imftypefunction8
imwrite>parse_inputssubfunction40
imwritefunction40
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
74
fmts = build_registry;
10.055 s55.6%
114
varargout{1} = find_in_registr...
840.022 s22.2%
81
case 0
880.011 s11.1%
68
persistent fmts;
880.011 s11.1%
143
mlock;
880 s0%
All other lines  0 s0%
Totals  0.098 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
imformats>build_registrysubfunction10.055 s55.6%
imformats>find_in_registrysubfunction840.022 s22.2%
Self time (built-ins, overhead, etc.)  0.022 s22.2%
Totals  0.098 s100% 
Code Analyzer results
Line numberMessage
Coverage results
[ Show coverage for parent directory ]
Total lines in function143
Non-code lines (comments, blank lines)103
Code lines (lines that can run)40
Code lines that did run19
Code lines that did not run21
Coverage (did run/can run)47.50 %
Function listing
   time   calls  line
1 function varargout = imformats(varargin)
2 %IMFORMATS Manage file format registry.
3 % FORMATS = IMFORMATS returns a structure containing all of the values in
4 % the file format registry. The fields in this structure are:
5 %
6 % ext - A cell array of file extensions for this format
7 % isa - Function to determine if a file "IS A" certain type
8 % info - Function to read information about a file
9 % read - Function to read image data a file
10 % write - Function to write MATLAB data to a file
11 % alpha - 1 if the format has an alpha channel, 0 otherwise
12 % description - A text description of the file format
13 %
14 % The values for the isa, info, read, and write fields must be functions
15 % which are on the MATLAB search path or function handles.
16 %
17 % FORMATS = IMFORMATS(FMT) searches the known formats for a format with
18 % extension given in the string "FMT." If found, a structure is returned
19 % containing the characteristics and function names. Otherwise an empty
20 % structure is returned.
21 %
22 % FORMATS = IMFORMATS(FORMAT_STRUCT) sets the format registry to contain
23 % the values in the "FORMAT_STRUCT" structure. The output structure
24 % FORMATS contains the new registry settings. See the "Warning" statement
25 % below.
26 %
27 % FORMATS = IMFORMATS('add', FORMAT_STRUCT) adds the values in the
28 % "FORMAT_STRUCT" structure to the format registry.
29 %
30 % FORMATS = IMFORMATS('factory') resets the file format registry to the
31 % default format registry values. This removes any user-specified
32 % settings.
33 %
34 % FORMATS = IMFORMATS('remove', FMT) removes the format with extension
35 % FMT from the format registry.
36 %
37 % FORMATS = IMFORMATS('update', FMT, FORMAT_STRUCT) change the format
38 % registry values for the format with extension FMT to have the values
39 % stored in FORMAT_STRUCT.
40 %
41 % IMFORMATS without any input or output arguments prettyprints a table of
42 % file format information for the supported formats.
43 %
44 % Warning:
45 %
46 % Using IMFORMATS to change the format registry is an advanced feature.
47 % Incorrect usage may prevent loading of image files. Use IMFORMATS
48 % with the 'factory' setting to return the format registry to a workable
49 % state.
50 %
51 % Note:
52 %
53 % Changes to the format registry do not persist between MATLAB sessions.
54 % To have a format always available when you start MATLAB, add the
55 % appropriate IMFORMATS commands to the startup.m file in
56 % $MATLAB/toolbox/local.
57 %
58 % See also IMREAD, IMWRITE, IMFINFO, FILEFORMATS, PATH.
59
60 % Copyright 1984-2008 The MathWorks, Inc.
61 % $Revision: 1.1.6.7 $ $Date: 2009/09/03 05:19:20 $
62
63 % Verify correct number of arguments
88 64 error(nargchk(0, 3, nargin, 'struct'));
88 65 error(nargoutchk(0, 1, nargout, 'struct'));
66
67 % Declare format structure as persistent variable
0.01 88 68 persistent fmts;
69
70 % If format structure is empty (first time)
88 71 if (isempty(fmts))
72
73 % Build default format structure
0.05 1 74 fmts = build_registry;
1 75 mlock
76
1 77 end
78
79 % Determine what to do based on number of input arguments
88 80 switch(nargin)
0.01 88 81 case 0
82 % 0 inputs: Informational only
83
4 84 if (nargout == 0)
85
86 % Pretty-print the registry
87 pretty_print_registry(fmts)
88
4 89 else
90
91 % Return the registry as a struct
4 92 varargout{1} = fmts;
93
4 94 end
95
84 96 case 1
97 % 1 input: Look for specific format or modify registry
98
84 99 if (isstruct(varargin{1}))
100
101 % Change the registry to contain the structure
102 fmts = update_registry(varargin{1});
103 varargout{1} = fmts;
104
84 105 elseif (isequal(lower(varargin{1}), 'factory'))
106
107 % Reset the registry to the default values
108 fmts = build_registry;
109 varargout{1} = fmts;
110
84 111 elseif (ischar(varargin{1}))
112
113 % Look for a particular format in the registry
0.02 84 114 varargout{1} = find_in_registry(fmts, varargin{1});
115
116 else
117
118 % Error out, wrong input argument type
119 error('MATLAB:imformats:badInputType', ...
120 'Input must be a structure or string.')
121
122 end
123
124 otherwise
125 % n inputs: Modify the registry using a command.
126
127 command = varargin{1};
128
129 switch (lower(command))
130 case 'add'
131 fmts = add_entry(fmts, varargin{2:end});
132 case 'update'
133 fmts = update_entry(fmts, varargin{2:end});
134 case 'remove'
135 fmts = remove_entry(fmts, varargin{2:end});
136 otherwise
137 error('MATLAB:imformats:unsupportedKeyword', ...
138 'Unsupported keyword %s.', command)
139 end
140 end
141
142 % Protect current file's persistent variables from CLEAR
88 143 mlock;

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