This is a static copy of a profile reportHome
strel>ParseInputs (3135 calls, 0.781 sec)
Generated 05-Nov-2014 07:52:43 using cpu time.
subfunction in file /usr1/opt/matlab/7.13/toolbox/images/images/strel.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
1112 | type = iptcheckstrs(varargin{1... | 1414 | 0.160 s | 20.5% |  |
1094 | iptchecknargin(1, 4, nargin, '... | 3135 | 0.080 s | 10.3% |  |
1126 | iptcheckinput(nhood, {'numeric... | 1721 | 0.060 s | 7.7% |  |
1227 | iptcheckinput(p, {'double'}, {... | 808 | 0.040 s | 5.1% |  |
1118 | switch type | 3135 | 0.040 s | 5.1% |  |
All other lines | | | 0.401 s | 51.3% |  |
Totals | | | 0.781 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
iptcheckstrs | function | 1414 | 0.110 s | 14.1% |  |
iptcheckinput | MEX-file | 4347 | 0.050 s | 6.4% |  |
iptchecknargin | function | 3135 | 0.040 s | 5.1% |  |
Self time (built-ins, overhead, etc.) | | | 0.581 s | 74.4% |  |
Totals | | | 0.781 s | 100% | |
Code Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 200 |
Non-code lines (comments, blank lines) | 54 |
Code lines (lines that can run) | 146 |
Code lines that did run | 49 |
Code lines that did not run | 97 |
Coverage (did run/can run) | 33.56 % |
Function listing
time calls line
1089 function [type,params] = ParseInputs(varargin)
1090
0.01 3135 1091 default_ball_n = 8;
0.01 3135 1092 default_disk_n = 4;
1093
0.08 3135 1094 iptchecknargin(1, 4, nargin, 'strel');
1095
0.02 3135 1096 if ~ischar(varargin{1})
0.01 1721 1097 type = 'arbitrary';
0.02 1721 1098 params = varargin;
1414 1099 else
0.01 1414 1100 params = varargin(2:end);
1101
1414 1102 valid_strings = {'arbitrary'
1103 'square'
1104 'diamond'
1105 'rectangle'
1106 'octagon'
1107 'line'
1108 'pair'
1109 'periodicline'
1110 'disk'
1111 'ball'};
0.16 1414 1112 type = iptcheckstrs(varargin{1}, valid_strings, 'strel', ...
1113 'STREL_TYPE', 1);
1414 1114 end
1115
0.02 3135 1116 num_params = numel(params);
1117
0.04 3135 1118 switch type
0.03 3135 1119 case 'arbitrary'
1721 1120 if num_params < 1
1121 error(message('images:strel:tooFewInputsForArbitrary'))
1122 end
1123
1124 % Check validity of the NHOOD argument.
1721 1125 nhood = params{1};
0.06 1721 1126 iptcheckinput(nhood, {'numeric', 'logical'}, {'real'}, 'strel', ...
1127 'NHOOD', 2);
1128
1129 % Check validity of the HEIGHT argument.
0.01 1721 1130 if num_params >= 2
1131 height = params{2};
1132 iptcheckinput(height, {'double'}, {'real', 'nonnan'}, 'strel', ...
1133 'HEIGHT', 3);
1134 if ~isequal(size(height), size(nhood))
1135 error(message('images:strel:sizeMismatch'))
1136 end
1721 1137 else
0.02 1721 1138 params{2} = zeros(size(nhood));
1721 1139 end
1140
0.03 1414 1141 case 'square'
1142 if (num_params < 1)
1143 error(message('images:strel:tooFewInputsForSquare'))
1144 end
1145 if (num_params > 1)
1146 error(message('images:strel:tooManyInputsForSquare'))
1147 end
1148 M = params{1};
1149 iptcheckinput(M, {'double'}, {'scalar' 'integer' 'real' 'nonnegative'}, ...
1150 'strel', 'SIZE', 2);
1151
1414 1152 case 'diamond'
1153 if (num_params < 1)
1154 error(message('images:strel:tooFewInputsForDiamond'))
1155 end
1156 if (num_params > 1)
1157 error(message('images:strel:tooManyInputsForDiamond'))
1158 end
1159 M = params{1};
1160 iptcheckinput(M, {'double'}, {'scalar' 'integer' 'nonnegative'}, ...
1161 'strel', 'SIZE', 2);
1162
1414 1163 case 'octagon'
1164 if (num_params < 1)
1165 error(message('images:strel:tooFewInputsForOctagon'))
1166 end
1167 if (num_params > 1)
1168 error(message('images:strel:tooManyInputsForOctagon'))
1169 end
1170 M = params{1};
1171 iptcheckinput(M, {'double'}, {'scalar' 'real' 'integer' 'nonnegative'}, ...
1172 'strel', 'SIZE', 2);
1173 if rem(M,3) ~= 0
1174 error(message('images:strel:notMultipleOf3'))
1175 end
1176
1414 1177 case 'rectangle'
1178 if (num_params < 1)
1179 error(message('images:strel:tooFewInputsForRectangle'))
1180 end
1181 if (num_params > 1)
1182 error(message('images:strel:tooManyInputsForRectangle'))
1183 end
1184 MN = params{1};
1185 iptcheckinput(MN, {'double'}, {'vector' 'real' 'integer' 'nonnegative'}, ...
1186 'strel', 'SIZE', 2);
1187 if numel(MN) ~= 2
1188 error(message('images:strel:badSizeForRectangle'))
1189 end
1190
0.02 1414 1191 case 'pair'
1192 if (num_params < 1)
1193 error(message('images:strel:tooFewInputsForPair'))
1194 end
1195 if (num_params > 1)
1196 error(message('images:strel:tooManyInputsForPair'))
1197 end
1198 RC = params{1};
1199 iptcheckinput(RC, {'double'}, {'vector' 'real' 'integer'}, ...
1200 'strel', 'OFFSET', 2);
1201 if numel(RC) ~= 2
1202 error(message('images:strel:badOffsetsForPair'))
1203 end
1204
0.01 1414 1205 case 'line'
404 1206 if (num_params < 2)
1207 error(message('images:strel:tooFewInputsForLine'))
1208 end
404 1209 if (num_params > 2)
1210 error(message('images:strel:tooManyInputsForLine'))
1211 end
404 1212 len = params{1};
0.01 404 1213 iptcheckinput(len, {'double'}, {'scalar' 'real' 'nonnegative'}, ...
1214 'strel', 'LEN', 2);
1215
404 1216 deg = params{2};
404 1217 iptcheckinput(deg, {'double'}, {'scalar' 'real'}, 'strel', 'DEG', 3);
1218
0.01 1010 1219 case 'periodicline'
0.01 808 1220 if (num_params < 2)
1221 error(message('images:strel:tooFewInputsForPeriodicLine'))
1222 end
808 1223 if (num_params > 2)
1224 error(message('images:strel:tooManyInputsForPeriodicLine'))
1225 end
808 1226 p = params{1};
0.04 808 1227 iptcheckinput(p, {'double'}, {'scalar' 'real' 'integer' 'nonnegative'}, ...
1228 'strel', 'P', 2);
1229
808 1230 v = params{2};
0.03 808 1231 iptcheckinput(v, {'double'}, {'vector' 'real' 'integer'}, 'strel', ...
1232 'V', 3);
0.01 808 1233 if numel(v) ~= 2
1234 error(message('images:strel:wrongSizeForV'))
1235 end
1236
0.01 202 1237 case 'disk'
202 1238 if (num_params < 1)
1239 error(message('images:strel:tooFewInputsForDisk'))
1240 end
202 1241 if (num_params > 2)
1242 error(message('images:strel:tooManyInputsForDisk'))
1243 end
1244
0.01 202 1245 r = params{1};
0.01 202 1246 iptcheckinput(r,{'double'}, {'scalar' 'real' 'integer' 'nonnegative'}, ...
1247 'strel', 'R', 2);
1248
202 1249 if (num_params < 2)
0.01 202 1250 params{2} = default_disk_n;
1251 else
1252 n = params{2};
1253 iptcheckinput(n, {'double'}, {'scalar' 'real' 'integer'}, ...
1254 'strel', 'N', 3);
1255 if ((n ~= 0) && (n ~= 4) && (n ~= 6) && (n ~= 8))
1256 error(message('images:strel:invalidN'))
1257 end
1258 end
1259
1260 case 'ball'
1261 if (num_params < 2)
1262 error(message('images:strel:tooFewInputsForBall'))
1263 end
1264 if (num_params > 3)
1265 error(message('images:strel:tooManyInputsForBall'))
1266 end
1267
1268 r = params{1};
1269 iptcheckinput(r, {'double'}, {'scalar' 'real' 'integer' 'nonnegative'}, ...
1270 'strel', 'R', 2);
1271
1272 h = params{2};
1273 iptcheckinput(h, {'double'}, {'scalar' 'real'}, 'strel', 'H', 3);
1274
1275 if (num_params < 3)
1276 params{3} = default_ball_n;
1277 else
1278 n = params{3};
1279 iptcheckinput(n, {'double'}, {'scalar' 'real' 'integer' 'nonnegative' ...
1280 'even'}, 'strel', 'N', 4);
1281 end
1282
1283 otherwise
1284 % This code should be unreachable.
1285 error(message('images:strel:unrecognizedStrelType'))
1286 end
1287
0.01 3135 1288 end