Skip to content

Commit 2dd0626

Browse files
committed
include MRI suffixes to the bids-validator test
1 parent 310120b commit 2dd0626

File tree

3 files changed

+54
-17
lines changed

3 files changed

+54
-17
lines changed

manualTests/test_makeRawDataset.m

Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,34 @@ function test_makeRawDataset()
77
end
88

99
%% set up
10-
11-
%%% set up
12-
13-
cfg.subject.subjectNb = 1;
14-
cfg.subject.runNb = 1;
15-
16-
cfg.task.name = 'testtask';
17-
1810
cfg.dir.output = outputDir;
1911

2012
cfg.bids.datasetDescription.Name = 'dummy';
2113
cfg.bids.datasetDescription.BIDSVersion = '1.0.0';
2214
cfg.bids.datasetDescription.Authors = {'Jane Doe', 'John Doe'};
15+
16+
cfg.testingDevice = 'mri';
2317

24-
cfg.bids.mri.RepetitionTime = 1.56;
18+
%% MRI task data
19+
cfg.mri.repetitionTime = 1.56;
2520

26-
cfg.testingDevice = 'mri';
21+
cfg.subject.subjectNb = 1;
22+
cfg.subject.runNb = 1;
23+
24+
cfg.task.name = 'testtask';
2725

2826
logFile.extraColumns.Speed.length = 1;
2927
logFile.extraColumns.LHL24.length = 3;
3028
logFile.extraColumns.is_Fixation.length = 1;
3129

32-
%%% do stuff
33-
3430
cfg = createFilename(cfg);
3531

36-
% create the events file and header
37-
logFile = saveEventsFile('open', cfg, logFile);
38-
3932
createBoldJson(cfg);
33+
4034
createDatasetDescription(cfg);
35+
36+
% create the events file and header
37+
logFile = saveEventsFile('open', cfg, logFile);
4138

4239
% ROW 2: normal events : all info is there
4340
logFile(1, 1).onset = 2;
@@ -74,11 +71,48 @@ function test_makeRawDataset()
7471
% add dummy functional data
7572
funcDir = fullfile(cfg.dir.output, 'source', 'sub-001', 'ses-001', 'func');
7673
boldFilename = 'sub-001_ses-001_task-testtask_run-001_bold.nii.gz';
74+
7775
copyfile( ...
7876
fullfile('..', 'dummyData', 'dummyData.nii.gz'), ...
7977
fullfile(funcDir, boldFilename));
78+
79+
%% MRI bold rest data and fancy suffixes
80+
clear cfg
81+
82+
cfg.dir.output = outputDir;
83+
84+
cfg.testingDevice = 'mri';
85+
86+
cfg.subject.subjectNb = 2;
87+
cfg.subject.sessionNb = 3;
88+
cfg.subject.runNb = 4;
89+
90+
cfg.mri.reconstruction = 'fast recon';
91+
cfg.mri.contrastEnhancement = 'test';
92+
cfg.mri.phaseEncodingDirection = 'y pos';
93+
cfg.mri.echo = '1';
94+
cfg.mri.acquisition = ' new tYpe';
95+
cfg.mri.repetitionTime = 1.56;
96+
97+
cfg.task.name = 'rest';
8098

81-
%%
99+
cfg = createFilename(cfg);
82100

101+
createBoldJson(cfg);
102+
103+
% add dummy functional data
104+
funcDir = fullfile(cfg.dir.output, 'source', 'sub-002', 'ses-003', 'func');
105+
boldFilename = ['sub-002_ses-003_task-rest', ...
106+
'_acq-newTYpe_ce-test_dir-yPos_rec-fastRecon', ...
107+
'_run-004_echo-1_bold.nii.gz'];
108+
109+
copyfile( ...
110+
fullfile('..', 'dummyData', 'dummyData.nii.gz'), ...
111+
fullfile(funcDir, boldFilename));
112+
113+
%%
114+
clear
115+
outputDir = fullfile(fileparts(mfilename('fullpath')), 'output');
116+
cfg.dir.output = outputDir;
83117
convertSourceToRaw(cfg);
84118
end

src/convertSourceToRaw.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function convertSourceToRaw(cfg)
1111
sourceDir = fullfile(cfg.dir.output, 'source');
1212
rawDir = fullfile(cfg.dir.output, 'rawdata');
1313

14-
% add dummy readme and change file
14+
% add dummy README and CHANGE file
1515
copyfile(fullfile( ...
1616
fileparts(mfilename('fullpath')), '..', 'dummyData', 'README'), ...
1717
sourceDir);
@@ -28,6 +28,7 @@ function convertSourceToRaw(cfg)
2828
error('No subjects found in BIDS directory.');
2929
end
3030

31+
% go through the subject files and parses them to remove the date suffix
3132
for su = 1:numel(subjects)
3233

3334
sess = cellstr(file_utils('List', fullfile(rawDir, subjects{su}), 'dir', '^ses-.*$'));

src/createFilename.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
function cfg = createFilename(cfg)
2+
% cfg = createFilename(cfg)
3+
%
24
% create the BIDS compliant directories and fileNames for the behavioral output
35
% for this subject / session / run using the information from cfg and expParameters.
46
% Will also create the right fileName for the eyetracking data file.

0 commit comments

Comments
 (0)