|
141 | 141 | end |
142 | 142 | end |
143 | 143 |
|
144 | | - if ~strcmpi(modelType, modelTypes.StandardLayers.value) && any(contrastRepeatLayers) |
| 144 | + if ~strcmpi(modelType, modelTypes.StandardLayers.value) && any(contrastRepeatLayers-1) |
145 | 145 | warning("Repeat Layers are only supported for standard layers calculations") |
146 | 146 | end |
147 | 147 |
|
|
203 | 203 | addParameter(p,'scalefactor', defaultScalefactor, @isText); |
204 | 204 | addParameter(p,'resolution', defaultResolution, @isText); |
205 | 205 | addParameter(p,'resample', defaultResample, @islogical); |
206 | | - addParameter(p,'repeatLayers', defaultRepeatLayers, @(x) isscalar(x) && isnumeric(x) && mod(x, 1) == 0 && x > 0); |
| 206 | + addParameter(p,'repeatLayers', defaultRepeatLayers, @isnumeric); |
207 | 207 |
|
208 | 208 | if obj.domainsCalc |
209 | 209 | defaultDomainRatio = ''; |
|
221 | 221 | inputBlock.bulkOut = obj.validateExactString(inputBlock.bulkOut, expectedBulkOut); |
222 | 222 | inputBlock.scalefactor = obj.validateExactString(inputBlock.scalefactor, expectedScalefactor); |
223 | 223 | inputBlock.resolution = obj.validateExactString(inputBlock.resolution, expectedResolution); |
| 224 | + inputBlock.repeatLayers = obj.validatePositiveInteger(inputBlock.repeatLayers); |
224 | 225 | inputBlock.model = obj.validateContrastModel(inputBlock.model, allowedNames); |
225 | 226 | if obj.domainsCalc |
226 | 227 | inputBlock.domainRatio = obj.validateExactString(inputBlock.domainRatio, expectedDomainRatio); |
|
243 | 244 | output = allowedNames{find(found, 1)}; |
244 | 245 | end |
245 | 246 |
|
| 247 | + function output = validatePositiveInteger(~, input) |
| 248 | + if isempty(input) |
| 249 | + output = []; |
| 250 | + return |
| 251 | + end |
| 252 | + if ~(isscalar(input) && mod(input, 1) == 0 && input > 0) |
| 253 | + throw(exceptions.invalidValue('The input "%s" must be a whole number greater than zero.', input)) |
| 254 | + end |
| 255 | + output = input; |
| 256 | + end |
| 257 | + |
246 | 258 | function model = validateContrastModel(obj, input, allowedNames) |
247 | 259 | if isempty(input) |
248 | 260 | model = ''; |
|
0 commit comments