Skip to content

Commit 661901e

Browse files
authored
[FIX] inconsistent slice timing throw errors and not warnings (#982)
* inconsistent slice timing throw errors and not warnings * update doc * fix tests * update doc
1 parent eb140c2 commit 661901e

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

src/batches/stats/setBatchSubjectLevelGLMSpec.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@
241241
try
242242
hdr = spm_vol(fullpathBoldFilename);
243243
catch
244-
warning('Could not open %s.\nThis expected during testing.', fullpathBoldFilename);
244+
warning('Could not open %s.\nExpected during testing.', fullpathBoldFilename);
245245
% TODO a value should be passed by user for this
246246
% hard coded value for test
247247
hdr = ones(200, 1);

src/bids/getAndCheckSliceOrder.m

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
function sliceOrder = getAndCheckSliceOrder(BIDS, opt, filter)
22
%
33
% Get the slice order information from the BIDS metadata.
4-
% If inconsistent slice timing is found across files it returns empty and
5-
% throws a warning.
4+
% If inconsistent slice timing is found across files
5+
% it throws an error.
66
%
77
% USAGE::
88
%
@@ -20,10 +20,10 @@
2020
% - :sliceOrder: a vector of the time when each slice was acquired in
2121
% in a volume or indicating the order of acquisition of the slices.
2222
%
23-
% ``getAndCheckSliceOrder`` will try to read the ``opt`` structure for any relevant information
24-
% about slice timing.
25-
% If this is empty, it queries the BIDS dataset to ee if there is any
26-
% consistent slice timing information for a given ``filter``
23+
% ``getAndCheckSliceOrder`` will try to read the ``opt`` structure
24+
% for any relevant information about slice timing.
25+
% If this is empty, it queries the BIDS dataset to see if there is any
26+
% consistent slice timing information for a given ``filter``.
2727
%
2828
% See also: bidsSTC, setBatchSTC
2929
%
@@ -57,10 +57,11 @@
5757

5858
sliceOrder = [];
5959

60-
msg = sprintf('inconsistent slice timing found for filter:\n%s.\n\n', ...
60+
msg = sprintf(['Inconsistent slice timing found for filter:\n%s.\n\n', ...
61+
'Number of slice per volume seems different across bold files.'], ...
6162
bids.internal.create_unordered_list(filter));
62-
id = 'inconsistentSliceTiming';
63-
logger('WARNING', msg, 'id', id, 'filename', mfilename(), 'options', opt);
63+
id = 'inconsistentSliceTimingLength';
64+
logger('ERROR', msg, 'id', id, 'filename', mfilename(), 'options', opt);
6465

6566
return
6667

@@ -76,9 +77,9 @@
7677

7778
sliceOrder = [];
7879

79-
wng = sprintf('inconsistent slice timing found for filter:\n%s.\n\n', ...
80+
msg = sprintf('Inconsistent slice timing found for filter:\n%s.\n\n', ...
8081
bids.internal.create_unordered_list(filter));
81-
id = 'inconsistentSliceTiming';
82+
id = 'inconsistentSliceTimingValues';
8283
logger('WARNING', msg, 'id', id, 'filename', mfilename(), 'options', opt);
8384

8485
return

src/messages/bidspmHelp.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function bidspmHelp()
7575
% Se to ``true`` to overwrites previous versions.
7676
% :type boilerplate_only: logical
7777
%
78-
% :param verbosity: can be ``0``, ``1`` or ``2``. Defaults to ``2``
78+
% :param verbosity: can be any value between ``0`` and ``3``. Defaults to ``2``
7979
% :type verbosity: positive integer
8080
%
8181
% :param space: Defaults to ``{'individual', 'IXI549Space'}``

tests/tests_batches/stats/test_setBatchSubjectLevelGLMSpec.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ function test_setBatchSubjectLevelGLMSpec_inconsistent_metadata()
170170
%% WHEN
171171
matlabbatch = {};
172172
assertExceptionThrown(@()setBatchSubjectLevelGLMSpec(matlabbatch, BIDS, opt, subLabel), ...
173-
'getAndCheckRepetitionTime:differentRepetitionTime');
173+
'getAndCheckSliceOrder:inconsistentSliceTimingLength');
174174

175175
end
176176

tests/tests_bids/unit_tests/test_getAndCheckSliceOrder.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ function test_getAndCheckSliceOrder_inconsistent_slice_timing()
3838

3939
[BIDS, opt, filter] = setUp({'vismotion', 'vislocalizer'});
4040

41-
sliceOrder = getAndCheckSliceOrder(BIDS, opt, filter);
42-
43-
assert(isempty(sliceOrder));
41+
assertExceptionThrown(@()getAndCheckSliceOrder(BIDS, opt, filter), ...
42+
'getAndCheckSliceOrder:inconsistentSliceTimingLength');
4443

4544
end
4645

0 commit comments

Comments
 (0)