This is a static copy of a profile report

Home

imformats (12977 calls, 8.532 sec)
Generated 05-Nov-2014 07:52:34 using cpu time.
function in file /usr1/opt/matlab/7.13/toolbox/matlab/imagesci/imformats.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
imagesci/private/imftypefunction12977
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
114
varargout{1} = find_in_registr...
129776.639 s77.8%
68
persistent fmts;
129770.280 s3.3%
105
elseif (isequal(lower(varargin...
129770.270 s3.2%
65
error(nargoutchk(0, 1, nargout...
129770.270 s3.2%
141
mlock;
129770.200 s2.3%
All other lines  0.871 s10.2%
Totals  8.532 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
imformats>find_in_registrysubfunction129776.299 s73.8%
Self time (built-ins, overhead, etc.)  2.233 s26.2%
Totals  8.532 s100% 
Code Analyzer results
Line numberMessage
Coverage results
[ Show coverage for parent directory ]
Total lines in function141
Non-code lines (comments, blank lines)101
Code lines (lines that can run)40
Code lines that did run12
Code lines that did not run28
Coverage (did run/can run)30.00 %
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.9 $ $Date: 2011/05/17 02:25:05 $
62
63 % Verify correct number of arguments
0.20 12977 64 error(nargchk(0, 3, nargin, 'struct'));
0.27 12977 65 error(nargoutchk(0, 1, nargout, 'struct'));
66
67 % Declare format structure as persistent variable
0.28 12977 68 persistent fmts;
69
70 % If format structure is empty (first time)
0.13 12977 71 if (isempty(fmts))
72
73 % Build default format structure
74 fmts = build_registry;
75 mlock
76
77 end
78
79 % Determine what to do based on number of input arguments
0.04 12977 80 switch(nargin)
0.07 12977 81 case 0
82 % 0 inputs: Informational only
83
84 if (nargout == 0)
85
86 % Pretty-print the registry
87 pretty_print_registry(fmts)
88
89 else
90
91 % Return the registry as a struct
92 varargout{1} = fmts;
93
94 end
95
0.07 12977 96 case 1
97 % 1 input: Look for specific format or modify registry
98
0.09 12977 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
0.27 12977 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
0.10 12977 111 elseif (ischar(varargin{1}))
112
113 % Look for a particular format in the registry
6.64 12977 114 varargout{1} = find_in_registry(fmts, varargin{1});
115
116 else
117
118 % Error out, wrong input argument type
119 error(message('MATLAB:imagesci:imformats:badInputType'))
120
121 end
122
123 otherwise
124 % n inputs: Modify the registry using a command.
125
126 command = varargin{1};
127
128 switch (lower(command))
129 case 'add'
130 fmts = add_entry(fmts, varargin{2:end});
131 case 'update'
132 fmts = update_entry(fmts, varargin{2:end});
133 case 'remove'
134 fmts = remove_entry(fmts, varargin{2:end});
135 otherwise
136 error(message('MATLAB:imagesci:imformats:unsupportedKeyword', command))
137 end
138 end
139
140 % Protect current file's persistent variables from CLEAR
0.20 12977 141 mlock;

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