This is a static copy of a profile report

Home

imuitools\private\imageDisplayParseInputs (1 call, 0.047 sec)
Generated 15-Mar-2007 12:02:00 using real time.
M-function in file C:\Program Files\MATLAB71\toolbox\images\imuitools\private\imageDisplayParseInputs.m
[Copy to new window for comparing multiple runs]

Parents (calling functions)

Function NameFunction TypeCalls
imshowM-function1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
205
cdata = validateCData(cdata,im...
10.016 s33.3%
162
iptcheckinput(cdata, {'numeric...
10.016 s33.3%
82
string_indices = find(cellfun(...
10.016 s33.3%
61
filename      = '';
10.000 s0.0%
83
valid_params = {'DisplayRange'...
10.000 s0.0%
Other lines & overhead  0 s0%
Totals  0.047 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
iptchecknarginM-function10 s0%
...e\imageDisplayParseInputs>getAutoCLimM-subfunction10 s0%
iptcheckinputMEX-function10 s0%
...splayParseInputs>parseParamValuePairsM-subfunction10 s0%
...imageDisplayParseInputs>findImageTypeM-subfunction10 s0%
...imageDisplayParseInputs>validateCDataM-subfunction10 s0%
...ageDisplayParseInputs>getCDataMappingM-subfunction10 s0%
...eDisplayParseInputs>checkDisplayRangeM-subfunction10 s0%
Self time (built-ins, overhead, etc.)  0.047 s99.9%
Totals  0.047 s100% 
M-Lint results
Line numberMessage
Coverage results
[ Show coverage for parent directory ]
Total lines in file219
Non-code lines (comments, blank lines)127
Code lines (lines that can run)92
Code lines that did run58
Code lines that did not run34
Coverage (did run/can run)63.04 %
Function listing
   time   calls  line
1 function [cdata, cdatamapping, clim, map, xdata, ydata, ...
2 initial_mag, style, filename] = ...
3 imageDisplayParseInputs(varargin)
4 %imageDisplayParseInputs Parse inputs for IMSHOW and IMTOOL.
5 %
6 % Valid syntaxes:
7 % IMSHOW/IMTOOL - no arguments
8 % IMSHOW/IMTOOL(I)
9 % IMSHOW/IMTOOL(I,[LOW HIGH])
10 % IMSHOW/IMTOOL(RGB)
11 % IMSHOW/IMTOOL(BW)
12 % IMSHOW/IMTOOL(X,MAP)
13 % IMSHOW/IMTOOL(FILENAME)
14 %
15 % IMSHOW/IMTOOL(...,PARAM1,VAL1,PARAM2,VAL2,...)
16 % Parameters include:
17 % 'DisplayRange', RANGE
18 % 'InitialMagnification', INITIAL_MAG
19 % 'XData',X
20 % 'YData',Y
21 % 'WindowStyle',STYLE
22
23 % Copyright 1993-2004 The MathWorks, Inc.
24 % $Revision: 1.1.8.2 $ $Date: 2004/12/18 07:36:36 $
25
26 % I/O Spec
27 % I 2-D, real, full matrix of class:
28 % uint8, uint16, int16, single, or double.
29 %
30 % BW 2-D, real full matrix of class logical.
31 %
32 % RGB M-by-N-by-3 3-D real, full array of class:
33 % uint8, uint16, int16, single, or double.
34 %
35 % X 2-D, real, full matrix of class:
36 % uint8, uint16, double
37 % if isa(X,'uint8') || isa(X,'uint16'): X <= size(MAP,1)-1
38 % if isa(X,'double'): 1 <= X <= size(MAP,1)
39 %
40 % MAP 2-D, real, full matrix
41 % if isa(X,'uint8'): size(MAP,1) <= 256
42 % if isa(X,'uint16') || isa(X,'double'): size(MAP,1) <= 65536
43 %
44 % RANGE 2 element vector or empty array, double
45 %
46 % FILENAME String of a valid filename that is on the path.
47 % File must be readable by IMREAD or DICOMREAD.
48 %
49 % INITIAL_MAG 'adaptive', 'fit'
50 % numeric scalar
51 %
52 % X,Y 2-element vector, can be more than 2 elements but only
53 % first and last are used.
54 %
55 % STYLE 'docked', 'normal'
56 %
57 % H image object (possibly subclass of HG image object with
58 % access to more navigational API)
59
60 % Defaults
< 0.01 1 61 filename = '';
< 0.01 1 62 cdata = [];
< 0.01 1 63 clim = []; % stays empty for indexed and RGB
< 0.01 1 64 map = [];
< 0.01 1 65 xdata = [];
< 0.01 1 66 ydata = [];
< 0.01 1 67 style = ''; % let imshow/imtool decide their own default
< 0.01 1 68 initial_mag = []; % let imshow/imtool decide their own default mag
69
1 70 num_args = length(varargin);
< 0.01 1 71 params_to_parse = false;
72
1 73 eid_invalid = sprintf('Images:%s:invalidInputs',mfilename);
< 0.01 1 74 msg_invalid = 'Invalid input arguments.';
75
76 % See if there are parameter-value pairs
77 % IMSHOW/IMTOOL(...,'DisplayRange',...
78 % 'InitialMagnification', INITIAL_MAG,...
79 % 'XData', x, ...
80 % 'YData', y, ...
81 % 'WindowStyle',STYLE,...
0.02 1 82 string_indices = find(cellfun('isclass',varargin,'char'));
< 0.01 1 83 valid_params = {'DisplayRange','InitialMagnification',...
84 'XData','YData','WindowStyle'};
1 85 if ~isempty(string_indices) && num_args > 1
< 0.01 1 86 params_to_parse = true;
87
< 0.01 1 88 is_first_string_first_arg = (string_indices(1)==1);
89
< 0.01 1 90 nargs_after_first_string = num_args - string_indices(1);
< 0.01 1 91 even_nargs_after_first_string = ~mod(nargs_after_first_string,2);
92
1 93 if is_first_string_first_arg && even_nargs_after_first_string
94 % IMSHOW/IMTOOL(FILENAME,PARAM,VALUE,...)
95 param1_index = string_indices(2);
< 0.01 1 96 else
97 % IMSHOW/IMTOOL(PARAM,VALUE,...)
98 % IMSHOW/IMTOOL(...,PARAM,VALUE,...)
< 0.01 1 99 param1_index = string_indices(1);
100
101 % Make sure first string is a real parameter, if not
102 % error here with generic message because user could
103 % be trying IMSHOW/IMTOOL(FILENAME,[]).
1 104 matches = strncmpi(varargin{param1_index},valid_params,...
105 length(varargin{param1_index}));
1 106 if ~any(matches) %i.e. none
107 error(eid_invalid, msg_invalid);
108 end
1 109 end
1 110 end
111
< 0.01 1 112 if params_to_parse
< 0.01 1 113 num_pre_param_args = param1_index-1;
< 0.01 1 114 num_args = num_pre_param_args;
< 0.01 1 115 end
116
1 117 iptchecknargin(0,2,num_args,mfilename);
118
1 119 switch num_args
1 120 case 1
121 % IMSHOW/IMTOOL(FILENAME)
122 % IMSHOW/IMTOOL(I)
123 % IMSHOW/IMTOOL(RGB)
124
125 if (ischar(varargin{1}))
126 % IMSHOW/IMTOOL(FILENAME)
127 filename = varargin{1};
128 [cdata,map] = getImageFromFile(filename);
129 else
130 % IMSHOW/IMTOOL(I)
131 % IMSHOW/IMTOOL(RGB)
132 cdata = varargin{1};
133 end
134
1 135 case 2
136 % IMSHOW/IMTOOL(I,[])
137 % IMSHOW/IMTOOL(I,[a b])
138 % IMSHOW/IMTOOL(X,map)
139
1 140 cdata = varargin{1};
141
1 142 if (isempty(varargin{2}))
143 % IMSHOW/IMTOOL(I,[])
1 144 clim = getAutoCLim(cdata);
145
146 elseif isequal(numel(varargin{2}),2)
147 % IMSHOW/IMTOOL(I,[a b])
148 clim = varargin{2};
149
150 elseif (size(varargin{2},2) == 3)
151 % IMSHOW/IMTOOL(X,map)
152 map = varargin{2};
153
154 else
155 error(eid_invalid, msg_invalid);
156
157 end
158
1 159 end
160
161 % Make sure CData is numeric before going any further.
0.02 1 162 iptcheckinput(cdata, {'numeric','logical'},...
163 {'nonsparse'}, ...
164 mfilename, 'I', 1);
165
1 166 if params_to_parse
1 167 args = parseParamValuePairs(varargin(param1_index:end),valid_params,...
168 num_pre_param_args,...
169 mfilename);
170
1 171 if isfield(args,'XData')
< 0.01 1 172 xdata = args.XData;
1 173 end
174
1 175 if isfield(args,'YData')
< 0.01 1 176 ydata = args.YData;
1 177 end
178
1 179 if isfield(args,'InitialMagnification')
180 initial_mag = args.InitialMagnification;
181 end
182
1 183 if isfield(args,'DisplayRange')
184 clim = args.DisplayRange;
185 if isempty(clim)
186 clim = getAutoCLim(cdata);
187 end
188 end
189
1 190 if isfield(args,'WindowStyle')
191 style = args.WindowStyle;
192 end
193
1 194 end
195
< 0.01 1 196 if isempty(xdata)
197 xdata = [1 size(cdata,2)];
198 end
199
< 0.01 1 200 if isempty(ydata)
201 ydata = [1 size(cdata,1)];
202 end
203
1 204 image_type = findImageType(cdata,map);
0.02 1 205 cdata = validateCData(cdata,image_type);
206
1 207 cdatamapping = getCDataMapping(image_type);
208
1 209 if strcmp(cdatamapping,'scaled')
210 map = gray(256);
211
212 if isempty(clim) || (clim(1) == clim(2))
213 clim = getrangefromclass(cdata);
214 end
215 end
216
1 217 clim = checkDisplayRange(clim);
218
219 %----------------------------------------------------

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