8
8
9
9
function test_query_participants()
10
10
11
- pth_bids_example = get_test_data_dir();
12
-
13
- BIDS = bids .layout(fullfile(pth_bids_example , ' pet002' ));
11
+ BIDS = bids .layout(fullfile(get_test_data_dir(), ' pet002' ));
14
12
15
13
participants = bids .query(BIDS , ' participants' );
16
14
17
- BIDS = bids .layout(fullfile(pth_bids_example , ' asl001' ));
15
+ BIDS = bids .layout(fullfile(get_test_data_dir() , ' asl001' ));
18
16
19
17
participants = bids .query(BIDS , ' participants' );
20
18
21
19
end
22
20
23
21
function test_query_impossible_suffix_should_return_empty()
24
22
25
- pth_bids_example = get_test_data_dir();
26
-
27
- BIDS = bids .layout(fullfile(pth_bids_example , ' synthetic' ));
23
+ BIDS = bids .layout(fullfile(get_test_data_dir(), ' synthetic' ));
28
24
29
25
% no suffix bold in anat
30
26
filter = struct(' sub' , ' 01' , ...
@@ -40,14 +36,12 @@ function test_query_impossible_suffix_should_return_empty()
40
36
41
37
function test_query_suffixes()
42
38
43
- pth_bids_example = get_test_data_dir();
44
-
45
- BIDS = bids .layout(fullfile(pth_bids_example , ' pet002' ));
39
+ BIDS = bids .layout(fullfile(get_test_data_dir(), ' pet002' ));
46
40
47
41
suffixes = {' T1w' , ' pet' };
48
42
assertEqual(bids .query(BIDS , ' suffixes' ), suffixes );
49
43
50
- BIDS = bids .layout(fullfile(pth_bids_example , ' synthetic' ));
44
+ BIDS = bids .layout(fullfile(get_test_data_dir() , ' synthetic' ));
51
45
52
46
suffixes = {' T1w' };
53
47
assertEqual(bids .query(BIDS , ' suffixes' , ' modality' , ' anat' ), suffixes );
@@ -56,9 +50,7 @@ function test_query_suffixes()
56
50
57
51
function test_query_subjects()
58
52
59
- pth_bids_example = get_test_data_dir();
60
-
61
- BIDS = bids .layout(fullfile(pth_bids_example , ' ieeg_visual' ));
53
+ BIDS = bids .layout(fullfile(get_test_data_dir(), ' ieeg_visual' ));
62
54
63
55
subjs = arrayfun(@(x ) sprintf(' %02d ' , x ), 1 : 2 , ' UniformOutput' , false );
64
56
assertEqual(bids .query(BIDS , ' subjects' ), subjs );
@@ -93,9 +85,7 @@ function test_query_regex_subjects_no_regex_by_default()
93
85
94
86
function test_query_regex_subjects()
95
87
96
- pth_bids_example = get_test_data_dir();
97
-
98
- BIDS = bids .layout(fullfile(pth_bids_example , ' ds000247' ));
88
+ BIDS = bids .layout(fullfile(get_test_data_dir(), ' ds000247' ));
99
89
100
90
data = bids .query(BIDS , ' data' , ' sub' , ' .*' , ' suffix' , ' T1w' );
101
91
@@ -109,9 +99,7 @@ function test_query_regex_subjects()
109
99
110
100
function test_query_with_indices()
111
101
112
- pth_bids_example = get_test_data_dir();
113
-
114
- BIDS = bids .layout(fullfile(pth_bids_example , ' ds105' ));
102
+ BIDS = bids .layout(fullfile(get_test_data_dir(), ' ds105' ));
115
103
116
104
data_1 = bids .query(BIDS , ' data' , ' sub' , ' 1' , ' run' , {3 , 5 , ' 7' , ' 01' }, ' suffix' , ' bold' );
117
105
data_2 = bids .query(BIDS , ' data' , ' sub' , ' 1' , ' run' , 1 : 2 : 7 , ' suffix' , ' bold' );
@@ -122,9 +110,7 @@ function test_query_with_indices()
122
110
123
111
function test_query_entities()
124
112
125
- pth_bids_example = get_test_data_dir();
126
-
127
- BIDS = bids .layout(fullfile(pth_bids_example , ' qmri_qsm' ));
113
+ BIDS = bids .layout(fullfile(get_test_data_dir(), ' qmri_qsm' ));
128
114
129
115
entities = bids .query(BIDS , ' entities' );
130
116
@@ -134,7 +120,7 @@ function test_query_entities()
134
120
assertEqual(entities , expected );
135
121
136
122
%%
137
- BIDS = bids .layout(fullfile(pth_bids_example , ' pet002' ));
123
+ BIDS = bids .layout(fullfile(get_test_data_dir() , ' pet002' ));
138
124
139
125
entities = bids .query(BIDS , ' entities' , ' suffix' , ' pet' );
140
126
@@ -147,24 +133,20 @@ function test_query_entities()
147
133
148
134
function test_query_events_tsv_in_root()
149
135
150
- pth_bids_example = get_test_data_dir();
151
-
152
- BIDS = bids .layout(fullfile(pth_bids_example , ' synthetic' ));
136
+ BIDS = bids .layout(fullfile(get_test_data_dir(), ' synthetic' ));
153
137
154
138
data = bids .query(BIDS , ' data' , ' sub' , ' 01' , ' ses' , ' 01' , ' task' , ' nback' , ' suffix' , ' events' );
155
139
156
140
assertEqual(data , ...
157
- {bids .internal .file_utils(fullfile(pth_bids_example , ...
141
+ {bids .internal .file_utils(fullfile(get_test_data_dir() , ...
158
142
' synthetic' , ...
159
143
' task-nback_events.tsv' ), ' cpath' )});
160
144
161
145
end
162
146
163
147
function test_query_exclude_entity()
164
148
165
- pth_bids_example = get_test_data_dir();
166
-
167
- BIDS = bids .layout(fullfile(pth_bids_example , ' ds000246' ));
149
+ BIDS = bids .layout(fullfile(get_test_data_dir(), ' ds000246' ));
168
150
169
151
filter = struct(' sub' , ' 0001' );
170
152
assertEqual(bids .query(BIDS , ' modalities' , filter ), {' anat' , ' meg' });
@@ -183,9 +165,7 @@ function test_query_exclude_entity()
183
165
184
166
function test_query_basic()
185
167
186
- pth_bids_example = get_test_data_dir();
187
-
188
- BIDS = bids .layout(fullfile(pth_bids_example , ' pet005' ));
168
+ BIDS = bids .layout(fullfile(get_test_data_dir(), ' pet005' ));
189
169
190
170
tasks = {' eyes' };
191
171
assertEqual(bids .query(BIDS , ' tasks' ), tasks );
@@ -200,9 +180,7 @@ function test_query_basic()
200
180
201
181
function test_query_data_filter()
202
182
203
- pth_bids_example = get_test_data_dir();
204
-
205
- BIDS = bids .layout(fullfile(pth_bids_example , ' pet005' ));
183
+ BIDS = bids .layout(fullfile(get_test_data_dir(), ' pet005' ));
206
184
207
185
% make sure that query can work with filter
208
186
filters = {' sub' , {' 01' }; ...
@@ -223,9 +201,7 @@ function test_query_data_filter()
223
201
224
202
function test_query_extension()
225
203
226
- pth_bids_example = get_test_data_dir();
227
-
228
- BIDS = bids .layout(fullfile(pth_bids_example , ' qmri_tb1tfl' ));
204
+ BIDS = bids .layout(fullfile(get_test_data_dir(), ' qmri_tb1tfl' ));
229
205
230
206
extensions = bids .query(BIDS , ' extensions' );
231
207
@@ -244,9 +220,7 @@ function test_query_extension()
244
220
245
221
function test_query_metadata()
246
222
247
- pth_bids_example = get_test_data_dir();
248
-
249
- BIDS = bids .layout(fullfile(pth_bids_example , ' qmri_tb1tfl' ));
223
+ BIDS = bids .layout(fullfile(get_test_data_dir(), ' qmri_tb1tfl' ));
250
224
251
225
md = bids .query(BIDS , ' metadata' , ...
252
226
' sub' , ' 01' , ...
@@ -260,9 +234,7 @@ function test_query_metadata()
260
234
261
235
function test_query_modalities()
262
236
263
- pth_bids_example = get_test_data_dir();
264
-
265
- BIDS = bids .layout(fullfile(pth_bids_example , ' pet002' ));
237
+ BIDS = bids .layout(fullfile(get_test_data_dir(), ' pet002' ));
266
238
267
239
modalities = {' anat' , ' pet' };
268
240
@@ -274,9 +246,7 @@ function test_query_modalities()
274
246
275
247
function test_query_tsv_content()
276
248
277
- pth_bids_example = get_test_data_dir();
278
-
279
- BIDS = bids .layout(fullfile(pth_bids_example , ' eeg_ds003645s_hed_inheritance' ));
249
+ BIDS = bids .layout(fullfile(get_test_data_dir(), ' eeg_ds003645s_hed_inheritance' ));
280
250
281
251
tsv_content = bids .query(BIDS , ' tsv_content' , ' suffix' , ' events' );
282
252
@@ -297,34 +267,28 @@ function test_query_tsv_content()
297
267
298
268
function test_query_tsv_content_error()
299
269
300
- pth_bids_example = get_test_data_dir();
301
-
302
- BIDS = bids .layout(fullfile(pth_bids_example , ' qmri_tb1tfl' ));
270
+ BIDS = bids .layout(fullfile(get_test_data_dir(), ' qmri_tb1tfl' ));
303
271
assertExceptionThrown(@()bids .query(BIDS , ' tsv_content' , ' extension' , ' .nii.gz' ), ...
304
272
' query:notJustTsvFiles' );
305
273
306
274
end
307
275
308
276
function test_query_sessions()
309
277
310
- pth_bids_example = get_test_data_dir();
311
-
312
- BIDS = bids .layout(fullfile(pth_bids_example , ' synthetic' ));
278
+ BIDS = bids .layout(fullfile(get_test_data_dir(), ' synthetic' ));
313
279
sessions = {' 01' , ' 02' };
314
280
assertEqual(bids .query(BIDS , ' sessions' ), sessions );
315
281
assertEqual(bids .query(BIDS , ' sessions' , ' sub' , ' 02' ), sessions );
316
282
317
- BIDS = bids .layout(fullfile(pth_bids_example , ' qmri_tb1tfl' ));
283
+ BIDS = bids .layout(fullfile(get_test_data_dir() , ' qmri_tb1tfl' ));
318
284
319
285
assert(isempty(bids .query(BIDS , ' sessions' )));
320
286
321
287
end
322
288
323
289
function test_query_sessions_tsv()
324
290
325
- pth_bids_example = get_test_data_dir();
326
-
327
- BIDS = bids .layout(fullfile(pth_bids_example , ' synthetic' ));
291
+ BIDS = bids .layout(fullfile(get_test_data_dir(), ' synthetic' ));
328
292
329
293
suffixes = bids .query(BIDS , ' suffixes' );
330
294
assert(ismember(' sessions' , suffixes ));
@@ -366,9 +330,7 @@ function test_query_sessions_tsv()
366
330
367
331
function test_query_scans_tsv()
368
332
369
- pth_bids_example = get_test_data_dir();
370
-
371
- BIDS = bids .layout(fullfile(pth_bids_example , ' motion_spotrotation' ));
333
+ BIDS = bids .layout(fullfile(get_test_data_dir(), ' motion_spotrotation' ));
372
334
373
335
suffixes = bids .query(BIDS , ' suffixes' );
374
336
assert(ismember(' scans' , suffixes ));
0 commit comments