Skip to content

Commit 8735318

Browse files
authored
Merge pull request #191 from Remi-Gau/misc
[ENH] save SoftwarePresentation details if present
2 parents a75bc98 + 069bd92 commit 8735318

File tree

5 files changed

+145
-127
lines changed

5 files changed

+145
-127
lines changed

runTests.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ function runTests()
2424
folderToCover = fullfile(pwd, 'src');
2525
testFolder = fullfile(pwd, 'tests');
2626

27-
success = moxunit_runtests( ...
28-
testFolder, ...
27+
addpath(fullfile(testFolder, 'utils'));
28+
29+
success = moxunit_runtests(testFolder, ...
2930
'-verbose', '-recursive', '-with_coverage', ...
3031
'-cover', folderToCover, ...
3132
'-cover_xml_file', 'coverage.xml', ...

src/createDataDictionary.m

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,23 @@ function createDataDictionary(cfg, logFile)
1717
fileName = strrep(logFile(1).filename, '.tsv', '.json');
1818
fullFilename = getFullFilename(fileName, cfg);
1919

20-
jsonContent = setJsonContent(logFile);
20+
jsonContent = setJsonContent(logFile, cfg);
2121

22-
opts.Indent = ' ';
23-
24-
bids.util.jsonencode(fullFilename, jsonContent, opts);
22+
bids.util.jsonencode(fullFilename, jsonContent);
2523

2624
end
2725

28-
function jsonContent = setJsonContent(logFile)
26+
function jsonContent = setJsonContent(logFile, cfg)
2927

3028
% regular _events file: add default _event file fields to the json content
3129
if ~isfield(logFile, 'isStim') || isempty(logFile.isStim) || ~logFile.isStim
3230

3331
jsonContent = logFile.columns;
3432

33+
if isfield(cfg, 'StimulusPresentation')
34+
jsonContent.StimulusPresentation = cfg.StimulusPresentation;
35+
end
36+
3537
% _stim file: write stim-specific fields to the json content
3638
elseif logFile.isStim
3739

src/createJson.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ function createJson(varargin)
1313
%
1414
% :param cfg: Configuration. See ``checkCFG()``.
1515
% :type cfg: structure
16+
%
1617
% :param modality: can be any of the following ``'beh'``, ``'func'``, ``'eeg'``,
1718
% ``'ieeg'``, ``'meg'``) to specify which JSON to save. If it is not
1819
% provided it will read from ``cfg.fileName.modality``.
1920
% :type modality: string
21+
%
2022
% :param extraInfo: contains information in the JSON file. Beware
2123
% that the BIDS validator is pretty strict on what information can
2224
% go in a JSON so this can be useful to store additional information
@@ -55,8 +57,7 @@ function createJson(varargin)
5557
end
5658

5759
%% save
58-
opts.Indent = ' ';
59-
bids.util.jsonencode(fullFilename, jsonContent, opts);
60+
bids.util.jsonencode(fullFilename, jsonContent);
6061

6162
end
6263

templates/.bidsignore

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
*_beh.*
2-
*_eeg.*
3-
*_ieeg.*
4-
*_meg.*
5-
6-
# *_beh.tsv
7-
# *_eeg.edf
8-
# *_ieeg.edf
9-
# *_meg.fif
1+
*_eeg.json
2+
*_eeg.edf
3+
4+
*_ieeg.json
5+
*_ieeg.edf
6+
7+
*_meg.json
8+
*_meg.fif
9+
10+
*_beh.tsv
1011

1112
# *_bold.nii.gz

0 commit comments

Comments
 (0)