Skip to content

Commit 4dc36d9

Browse files
committed
Addresses review comments
1 parent 41784a0 commit 4dc36d9

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

API/projectClass/contrastsClass.m

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
end
142142
end
143143

144-
if ~strcmpi(modelType, modelTypes.StandardLayers.value) && any(contrastRepeatLayers)
144+
if ~strcmpi(modelType, modelTypes.StandardLayers.value) && any(contrastRepeatLayers-1)
145145
warning("Repeat Layers are only supported for standard layers calculations")
146146
end
147147

@@ -203,7 +203,7 @@
203203
addParameter(p,'scalefactor', defaultScalefactor, @isText);
204204
addParameter(p,'resolution', defaultResolution, @isText);
205205
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);
207207

208208
if obj.domainsCalc
209209
defaultDomainRatio = '';
@@ -221,6 +221,7 @@
221221
inputBlock.bulkOut = obj.validateExactString(inputBlock.bulkOut, expectedBulkOut);
222222
inputBlock.scalefactor = obj.validateExactString(inputBlock.scalefactor, expectedScalefactor);
223223
inputBlock.resolution = obj.validateExactString(inputBlock.resolution, expectedResolution);
224+
inputBlock.repeatLayers = obj.validatePositiveInteger(inputBlock.repeatLayers);
224225
inputBlock.model = obj.validateContrastModel(inputBlock.model, allowedNames);
225226
if obj.domainsCalc
226227
inputBlock.domainRatio = obj.validateExactString(inputBlock.domainRatio, expectedDomainRatio);
@@ -243,6 +244,17 @@
243244
output = allowedNames{find(found, 1)};
244245
end
245246

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+
246258
function model = validateContrastModel(obj, input, allowedNames)
247259
if isempty(input)
248260
model = '';

0 commit comments

Comments
 (0)