diff --git a/+bids/layout.m b/+bids/layout.m index 923cb779..04a7d34e 100644 --- a/+bids/layout.m +++ b/+bids/layout.m @@ -391,6 +391,8 @@ file_list = return_file_list(modality, subject, schema); + electrode_tsv = list_electrodes(modality, file_list); + % dependency previous file previous = struct('group', struct('index', 0, 'base', '', 'len', 1), ... 'data', struct('index', 0, 'base', '', 'len', 1), ... @@ -440,6 +442,9 @@ subject.(modality)(end) = manage_M0(subject.perf(end), pth, verbose); + case {'eeg', 'ieeg', 'nirs'} + subject = appent_electrodes(subject, modality, electrode_tsv); + end end @@ -450,6 +455,39 @@ end +function electrode_tsv = list_electrodes(modality, file_list) + + electrode_tsv = {}; + + switch modality + case {'eeg', 'ieeg'} + suffix = 'electrodes'; + case {'nirs'} + suffix = 'optodes'; + otherwise + return + end + + is_electrode_tsv = ~cellfun('isempty', ... + strfind(file_list, ['_' suffix '.tsv'])); + has_electrode_tsv = any(is_electrode_tsv); + if has_electrode_tsv + electrode_tsv = file_list(is_electrode_tsv); + end + +end + +function subject = appent_electrodes(subject, modality, electrode_tsv) + for i = 1:numel(electrode_tsv) + pth = fullfile(subject.path, modality); + fullpath_filename = fullfile(pth, electrode_tsv{i}); + if ~ismember(fullpath_filename, ... + subject.(modality)(end).dependencies.group) + subject.(modality)(end).dependencies.group{end + 1, 1} = fullpath_filename; + end + end +end + function BIDS = validate_description(BIDS, tolerant, verbose) if ~exist(fullfile(BIDS.pth, 'dataset_description.json'), 'file') @@ -578,6 +616,8 @@ % This groups file that logically need each other, % like functional mri and events tabular file. % It also takes care of fmap magnitude1/2 and phasediff. + % This will also include files that are shared across + % several runs (i.e electrodes.tsv) pth = fullfile(subject.path, modality); fullpath_filename = fullfile(pth, file); diff --git a/tests/tests_query/test_bids_query.m b/tests/tests_query/test_bids_query.m index 76f8188f..fda54c70 100644 --- a/tests/tests_query/test_bids_query.m +++ b/tests/tests_query/test_bids_query.m @@ -8,13 +8,11 @@ function test_query_participants() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'pet002')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'pet002')); participants = bids.query(BIDS, 'participants'); - BIDS = bids.layout(fullfile(pth_bids_example, 'asl001')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'asl001')); participants = bids.query(BIDS, 'participants'); @@ -22,9 +20,7 @@ function test_query_participants() function test_query_impossible_suffix_should_return_empty() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'synthetic')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'synthetic')); % no suffix bold in anat filter = struct('sub', '01', ... @@ -40,14 +36,12 @@ function test_query_impossible_suffix_should_return_empty() function test_query_suffixes() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'pet002')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'pet002')); suffixes = {'T1w', 'pet'}; assertEqual(bids.query(BIDS, 'suffixes'), suffixes); - BIDS = bids.layout(fullfile(pth_bids_example, 'synthetic')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'synthetic')); suffixes = {'T1w'}; assertEqual(bids.query(BIDS, 'suffixes', 'modality', 'anat'), suffixes); @@ -56,9 +50,7 @@ function test_query_suffixes() function test_query_subjects() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'ieeg_visual')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'ieeg_visual')); subjs = arrayfun(@(x) sprintf('%02d', x), 1:2, 'UniformOutput', false); assertEqual(bids.query(BIDS, 'subjects'), subjs); @@ -93,9 +85,7 @@ function test_query_regex_subjects_no_regex_by_default() function test_query_regex_subjects() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'ds000247')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'ds000247')); data = bids.query(BIDS, 'data', 'sub', '.*', 'suffix', 'T1w'); @@ -109,9 +99,7 @@ function test_query_regex_subjects() function test_query_with_indices() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'ds105')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'ds105')); data_1 = bids.query(BIDS, 'data', 'sub', '1', 'run', {3, 5, '7', '01'}, 'suffix', 'bold'); data_2 = bids.query(BIDS, 'data', 'sub', '1', 'run', 1:2:7, 'suffix', 'bold'); @@ -122,9 +110,7 @@ function test_query_with_indices() function test_query_entities() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'qmri_qsm')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'qmri_qsm')); entities = bids.query(BIDS, 'entities'); @@ -134,7 +120,7 @@ function test_query_entities() assertEqual(entities, expected); %% - BIDS = bids.layout(fullfile(pth_bids_example, 'pet002')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'pet002')); entities = bids.query(BIDS, 'entities', 'suffix', 'pet'); @@ -147,14 +133,12 @@ function test_query_entities() function test_query_events_tsv_in_root() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'synthetic')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'synthetic')); data = bids.query(BIDS, 'data', 'sub', '01', 'ses', '01', 'task', 'nback', 'suffix', 'events'); assertEqual(data, ... - {bids.internal.file_utils(fullfile(pth_bids_example, ... + {bids.internal.file_utils(fullfile(get_test_data_dir(), ... 'synthetic', ... 'task-nback_events.tsv'), 'cpath')}); @@ -162,9 +146,7 @@ function test_query_events_tsv_in_root() function test_query_exclude_entity() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'ds000246')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'ds000246')); filter = struct('sub', '0001'); assertEqual(bids.query(BIDS, 'modalities', filter), {'anat', 'meg'}); @@ -183,9 +165,7 @@ function test_query_exclude_entity() function test_query_basic() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'pet005')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'pet005')); tasks = {'eyes'}; assertEqual(bids.query(BIDS, 'tasks'), tasks); @@ -200,9 +180,7 @@ function test_query_basic() function test_query_data_filter() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'pet005')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'pet005')); % make sure that query can work with filter filters = {'sub', {'01'}; ... @@ -223,9 +201,7 @@ function test_query_data_filter() function test_query_extension() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'qmri_tb1tfl')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'qmri_tb1tfl')); extensions = bids.query(BIDS, 'extensions'); @@ -244,9 +220,7 @@ function test_query_extension() function test_query_metadata() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'qmri_tb1tfl')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'qmri_tb1tfl')); md = bids.query(BIDS, 'metadata', ... 'sub', '01', ... @@ -260,9 +234,7 @@ function test_query_metadata() function test_query_modalities() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'pet002')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'pet002')); modalities = {'anat', 'pet'}; @@ -274,9 +246,7 @@ function test_query_modalities() function test_query_tsv_content() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'eeg_ds003645s_hed_inheritance')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'eeg_ds003645s_hed_inheritance')); tsv_content = bids.query(BIDS, 'tsv_content', 'suffix', 'events'); @@ -297,9 +267,7 @@ function test_query_tsv_content() function test_query_tsv_content_error() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'qmri_tb1tfl')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'qmri_tb1tfl')); assertExceptionThrown(@()bids.query(BIDS, 'tsv_content', 'extension', '.nii.gz'), ... 'query:notJustTsvFiles'); @@ -307,14 +275,12 @@ function test_query_tsv_content_error() function test_query_sessions() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'synthetic')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'synthetic')); sessions = {'01', '02'}; assertEqual(bids.query(BIDS, 'sessions'), sessions); assertEqual(bids.query(BIDS, 'sessions', 'sub', '02'), sessions); - BIDS = bids.layout(fullfile(pth_bids_example, 'qmri_tb1tfl')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'qmri_tb1tfl')); assert(isempty(bids.query(BIDS, 'sessions'))); @@ -322,9 +288,7 @@ function test_query_sessions() function test_query_sessions_tsv() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'synthetic')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'synthetic')); suffixes = bids.query(BIDS, 'suffixes'); assert(ismember('sessions', suffixes)); @@ -366,9 +330,7 @@ function test_query_sessions_tsv() function test_query_scans_tsv() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'motion_spotrotation')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'motion_spotrotation')); suffixes = bids.query(BIDS, 'suffixes'); assert(ismember('scans', suffixes)); diff --git a/tests/tests_query/test_bids_query_asl.m b/tests/tests_query/test_bids_query_asl.m index 76c48d31..d1eb644f 100644 --- a/tests/tests_query/test_bids_query_asl.m +++ b/tests/tests_query/test_bids_query_asl.m @@ -8,9 +8,7 @@ function test_bids_query_asl_basic_asl002() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'asl002')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'asl002')); modalities = {'anat', 'perf'}; assertEqual(bids.query(BIDS, 'modalities'), modalities); @@ -37,9 +35,7 @@ function test_bids_query_asl_basic_asl002() function test_bids_query_asl_basic_asl001() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'asl001')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'asl001')); modalities = {'anat', 'perf'}; assertEqual(bids.query(BIDS, 'modalities'), modalities); @@ -68,9 +64,7 @@ function test_bids_query_asl_basic_asl001() function test_bids_query_asl_basic_asl003() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'asl003')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'asl003')); modalities = {'anat', 'perf'}; assertEqual(bids.query(BIDS, 'modalities'), modalities); @@ -82,9 +76,7 @@ function test_bids_query_asl_basic_asl003() function test_bids_query_asl_basic_asl004() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'asl004')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'asl004')); modalities = {'anat', 'fmap', 'perf'}; assertEqual(bids.query(BIDS, 'modalities'), modalities); diff --git a/tests/tests_query/test_bids_query_derivatives.m b/tests/tests_query/test_bids_query_derivatives.m index 001c8753..f22d6279 100644 --- a/tests/tests_query/test_bids_query_derivatives.m +++ b/tests/tests_query/test_bids_query_derivatives.m @@ -8,9 +8,7 @@ function test_bids_query_derivatives_basic() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'ds000001-fmriprep'), ... + BIDS = bids.layout(fullfile(get_test_data_dir(), 'ds000001-fmriprep'), ... 'use_schema', false); spaces = bids.query(BIDS, 'spaces'); diff --git a/tests/tests_query/test_bids_query_dwi.m b/tests/tests_query/test_bids_query_dwi.m index 29e5d4b4..4e8fc39b 100644 --- a/tests/tests_query/test_bids_query_dwi.m +++ b/tests/tests_query/test_bids_query_dwi.m @@ -10,11 +10,8 @@ function test_bids_query_dwi_basic() % % dwi queries % - - pth_bids_example = get_test_data_dir(); - %% - BIDS = bids.layout(fullfile(pth_bids_example, 'eeg_rest_fmri')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'eeg_rest_fmri')); modalities = {'anat', 'dwi', 'eeg', 'func'}; assertEqual(bids.query(BIDS, 'modalities'), modalities); diff --git a/tests/tests_query/test_bids_query_eeg.m b/tests/tests_query/test_bids_query_eeg.m index 4c60fe4b..cc480d8d 100644 --- a/tests/tests_query/test_bids_query_eeg.m +++ b/tests/tests_query/test_bids_query_eeg.m @@ -6,26 +6,39 @@ initTestSuite; end -function test_bids_query_eeg_basic() +function test_bids_query_eeg_basic_1() % % eeg queries % - pth_bids_example = get_test_data_dir(); - %% - BIDS = bids.layout(fullfile(pth_bids_example, 'eeg_face13')); + BIDS = bids.layout(fullfile(get_test_data_dir, 'eeg_face13')); modalities = {'eeg'}; assertEqual(bids.query(BIDS, 'modalities'), modalities); + % Missing: 'coordsystem' suffixes = {'channels', 'eeg', 'electrodes', 'events'}; assertEqual(bids.query(BIDS, 'suffixes'), suffixes); extension = bids.query(BIDS, 'data', 'extension', '.tsv'); + %% dependencies + dependencies = bids.query(BIDS, 'dependencies', ... + 'sub', '001', ... + 'suffix', 'eeg'); + + assertEqual(numel(dependencies.group), 3); + +end + +function test_bids_query_eeg_basic_2() + % + % eeg queries + % + %% - BIDS = bids.layout(fullfile(pth_bids_example, 'eeg_ds000117')); + BIDS = bids.layout(fullfile(get_test_data_dir, 'eeg_ds000117')); modalities = {'anat', 'eeg'}; assertEqual(bids.query(BIDS, 'modalities'), modalities); @@ -42,6 +55,6 @@ function test_bids_query_eeg_basic() 'extension', '.set'); assertEqual(numel(dependencies.data), 1); - assertEqual(numel(dependencies.group), 1); + assertEqual(numel(dependencies.group), 2); end diff --git a/tests/tests_query/test_bids_query_fmap.m b/tests/tests_query/test_bids_query_fmap.m index 2e2bbcf3..6ebd0e0d 100644 --- a/tests/tests_query/test_bids_query_fmap.m +++ b/tests/tests_query/test_bids_query_fmap.m @@ -9,9 +9,7 @@ function test_query_extension() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, '7t_trt')); + BIDS = bids.layout(fullfile(get_test_data_dir(), '7t_trt')); BIDS.subjects(1).func(1).dependencies.explicit; @@ -25,7 +23,7 @@ function test_query_extension() assertEqual(numel(dependencies.group), 2); - BIDS = bids.layout(fullfile(pth_bids_example, 'hcp_example_bids')); % sub-100307 + BIDS = bids.layout(fullfile(get_test_data_dir(), 'hcp_example_bids')); % sub-100307 BIDS.subjects(1).anat(1).dependencies.explicit; diff --git a/tests/tests_query/test_bids_query_func.m b/tests/tests_query/test_bids_query_func.m index 9935a005..0e541954 100644 --- a/tests/tests_query/test_bids_query_func.m +++ b/tests/tests_query/test_bids_query_func.m @@ -11,9 +11,7 @@ function test_bids_query_func_basic() % func queries % - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'ds001')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'ds001')); %% dependencies dependencies = bids.query(BIDS, 'dependencies', ... diff --git a/tests/tests_query/test_bids_query_ieeg.m b/tests/tests_query/test_bids_query_ieeg.m index 8f88b330..89c85260 100644 --- a/tests/tests_query/test_bids_query_ieeg.m +++ b/tests/tests_query/test_bids_query_ieeg.m @@ -6,15 +6,13 @@ initTestSuite; end -function test_bids_query_ieeg_basic() +function test_bids_query_ieeg_basic_1() % % eeg queries % - pth_bids_example = get_test_data_dir(); - %% - BIDS = bids.layout(fullfile(pth_bids_example, 'ieeg_epilepsy')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'ieeg_epilepsy')); modalities = {'anat', 'ieeg'}; assertEqual(bids.query(BIDS, 'modalities'), modalities); @@ -23,8 +21,24 @@ function test_bids_query_ieeg_basic() % Missing: 'coordsystem' assertEqual(bids.query(BIDS, 'suffixes'), suffixes); + %% dependencies + dependencies = bids.query(BIDS, 'dependencies', ... + 'sub', '01', ... + 'run', '01', ... + 'suffix', 'ieeg', ... + 'extension', '.eeg'); + + assertEqual(numel(dependencies.group), 4); + +end + +function test_bids_query_ieeg_basic_2() + % + % eeg queries + % + %% - BIDS = bids.layout(fullfile(pth_bids_example, 'ieeg_epilepsy_ecog')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'ieeg_epilepsy_ecog')); modalities = {'anat', 'ieeg'}; assertEqual(bids.query(BIDS, 'modalities'), modalities); @@ -33,4 +47,12 @@ function test_bids_query_ieeg_basic() % Missing: 'coordsystem' assertEqual(bids.query(BIDS, 'suffixes'), suffixes); + %% dependencies + dependencies = bids.query(BIDS, 'dependencies', ... + 'sub', 'ecog01', ... + 'suffix', 'ieeg', ... + 'extension', '.eeg'); + + assertEqual(numel(dependencies.group), 4); + end diff --git a/tests/tests_query/test_bids_query_matlab_octave.m b/tests/tests_query/test_bids_query_matlab_octave.m index 835ced95..1d74463a 100644 --- a/tests/tests_query/test_bids_query_matlab_octave.m +++ b/tests/tests_query/test_bids_query_matlab_octave.m @@ -11,9 +11,7 @@ function test_query_impossible_suffix_should_return_empty() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, '7t_trt')); + BIDS = bids.layout(fullfile(get_test_data_dir(), '7t_trt')); subjects = bids.query(BIDS, 'subjects'); assertEqual(size(subjects), [1, 22]); diff --git a/tests/tests_query/test_bids_query_meg.m b/tests/tests_query/test_bids_query_meg.m index b12e7f5d..9a50d795 100644 --- a/tests/tests_query/test_bids_query_meg.m +++ b/tests/tests_query/test_bids_query_meg.m @@ -11,9 +11,7 @@ function test_bids_query_meg_basic() % meg queries % - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'ds000246')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'ds000246')); modalities = {'anat', 'meg'}; assertEqual(bids.query(BIDS, 'modalities'), modalities); @@ -23,9 +21,9 @@ function test_bids_query_meg_basic() assertEqual(bids.query(BIDS, 'suffixes'), suffixes); % smoke tests - BIDS = bids.layout(fullfile(pth_bids_example, 'ds000247')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'ds000247')); - BIDS = bids.layout(fullfile(pth_bids_example, 'ds000248')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'ds000248')); dependencies = bids.query(BIDS, 'dependencies', 'sub', '01', 'suffix', 'meg'); diff --git a/tests/tests_query/test_bids_query_microscopy.m b/tests/tests_query/test_bids_query_microscopy.m index 99c7aa6f..1bc991a6 100644 --- a/tests/tests_query/test_bids_query_microscopy.m +++ b/tests/tests_query/test_bids_query_microscopy.m @@ -8,14 +8,12 @@ function test_bids_query_microscopy_basic() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'micr_SEM')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'micr_SEM')); data = bids.query(BIDS, 'data'); assertEqual(numel(data), 6); - BIDS = bids.layout(fullfile(pth_bids_example, 'micr_SPIM')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'micr_SPIM')); data = bids.query(BIDS, 'data'); assertEqual(numel(data), 11); diff --git a/tests/tests_query/test_bids_query_motion.m b/tests/tests_query/test_bids_query_motion.m index 687db81e..62ee47ee 100644 --- a/tests/tests_query/test_bids_query_motion.m +++ b/tests/tests_query/test_bids_query_motion.m @@ -11,9 +11,7 @@ function test_bids_query_motion_basic() % motion queries % - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'motion_spotrotation')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'motion_spotrotation')); optodes_files = bids.query(BIDS, 'data', ... 'suffix', 'channels'); diff --git a/tests/tests_query/test_bids_query_nirs.m b/tests/tests_query/test_bids_query_nirs.m index 5e550b86..44d39b6e 100644 --- a/tests/tests_query/test_bids_query_nirs.m +++ b/tests/tests_query/test_bids_query_nirs.m @@ -11,9 +11,7 @@ function test_bids_query_nirs_basic() % nirs queries % - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'fnirs_tapping')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'fnirs_tapping')); optodes_files = bids.query(BIDS, 'data', ... 'suffix', 'optodes'); @@ -27,6 +25,14 @@ function test_bids_query_nirs_basic() 'suffix', 'nirs'); assertEqual(numel(nirs_files), 5); + %% dependencies + dependencies = bids.query(BIDS, 'dependencies', ... + 'sub', '01', ... + 'suffix', 'nirs', ... + 'extension', '.snirf'); + + assertEqual(numel(dependencies.group), 3); + % TODO: cannot query coordsystem file coordsystem_files = bids.query(BIDS, 'metadata', ... 'suffix', 'coordsystem'); diff --git a/tests/tests_query/test_bids_query_qmri.m b/tests/tests_query/test_bids_query_qmri.m index fbfe6eb6..fd6676ff 100644 --- a/tests/tests_query/test_bids_query_qmri.m +++ b/tests/tests_query/test_bids_query_qmri.m @@ -8,9 +8,7 @@ function test_bids_query_qmri_megre_echos() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'qmri_megre')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'qmri_megre')); echos = bids.query(BIDS, 'echos', 'modality', 'anat'); assertEqual(numel(echos), 8); @@ -19,9 +17,7 @@ function test_bids_query_qmri_megre_echos() function test_bids_query_qmri_irt1_inv() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'qmri_irt1')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'qmri_irt1')); inversions = bids.query(BIDS, 'inversions'); assertEqual(numel(inversions), 4); diff --git a/tests/tests_query/test_query_bug_453.m b/tests/tests_query/test_query_bug_453.m index 9f86f468..56c2a8e5 100644 --- a/tests/tests_query/test_query_bug_453.m +++ b/tests/tests_query/test_query_bug_453.m @@ -1,8 +1,6 @@ function test_query_bug_453() - pth_bids_example = get_test_data_dir(); - - BIDS = bids.layout(fullfile(pth_bids_example, 'ds000248')); + BIDS = bids.layout(fullfile(get_test_data_dir(), 'ds000248')); assertEqual(bids.query(BIDS, 'modalities'), {'anat', 'meg'}); assertEqual(bids.query(BIDS, 'modalities', 'task', '.*'), {'meg'});