Skip to content

[ENH] save SoftwarePresentation details if present #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions runTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ function runTests()
folderToCover = fullfile(pwd, 'src');
testFolder = fullfile(pwd, 'tests');

success = moxunit_runtests( ...
testFolder, ...
addpath(fullfile(testFolder, 'utils'));

success = moxunit_runtests(testFolder, ...
'-verbose', '-recursive', '-with_coverage', ...
'-cover', folderToCover, ...
'-cover_xml_file', 'coverage.xml', ...
Expand Down
12 changes: 7 additions & 5 deletions src/createDataDictionary.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,23 @@ function createDataDictionary(cfg, logFile)
fileName = strrep(logFile(1).filename, '.tsv', '.json');
fullFilename = getFullFilename(fileName, cfg);

jsonContent = setJsonContent(logFile);
jsonContent = setJsonContent(logFile, cfg);

opts.Indent = ' ';

bids.util.jsonencode(fullFilename, jsonContent, opts);
bids.util.jsonencode(fullFilename, jsonContent);

end

function jsonContent = setJsonContent(logFile)
function jsonContent = setJsonContent(logFile, cfg)

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

jsonContent = logFile.columns;

if isfield(cfg, 'StimulusPresentation')
jsonContent.StimulusPresentation = cfg.StimulusPresentation;
end

% _stim file: write stim-specific fields to the json content
elseif logFile.isStim

Expand Down
5 changes: 3 additions & 2 deletions src/createJson.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ function createJson(varargin)
%
% :param cfg: Configuration. See ``checkCFG()``.
% :type cfg: structure
%
% :param modality: can be any of the following ``'beh'``, ``'func'``, ``'eeg'``,
% ``'ieeg'``, ``'meg'``) to specify which JSON to save. If it is not
% provided it will read from ``cfg.fileName.modality``.
% :type modality: string
%
% :param extraInfo: contains information in the JSON file. Beware
% that the BIDS validator is pretty strict on what information can
% go in a JSON so this can be useful to store additional information
Expand Down Expand Up @@ -55,8 +57,7 @@ function createJson(varargin)
end

%% save
opts.Indent = ' ';
bids.util.jsonencode(fullFilename, jsonContent, opts);
bids.util.jsonencode(fullFilename, jsonContent);

end

Expand Down
19 changes: 10 additions & 9 deletions templates/.bidsignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
*_beh.*
*_eeg.*
*_ieeg.*
*_meg.*

# *_beh.tsv
# *_eeg.edf
# *_ieeg.edf
# *_meg.fif
*_eeg.json
*_eeg.edf

*_ieeg.json
*_ieeg.edf

*_meg.json
*_meg.fif

*_beh.tsv

# *_bold.nii.gz
Loading