From ca63eaaf22589d6376da7d0253bc0105a1cb3dc1 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 4 Sep 2023 14:30:37 -0400 Subject: [PATCH] fix tests after merge from main --- +bids/+util/create_scans_tsv.m | 8 ++++++-- tests/data/reports/ds000117_anat.md | 6 ++++-- tests/tests_utils/test_create_scans_tsv.m | 24 +++++++++++------------ tests/utils/validate_dataset.m | 2 +- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/+bids/+util/create_scans_tsv.m b/+bids/+util/create_scans_tsv.m index 79f3071f..24f53424 100644 --- a/+bids/+util/create_scans_tsv.m +++ b/+bids/+util/create_scans_tsv.m @@ -74,7 +74,11 @@ %% output_filenames = {}; - layout = bids.layout(layout_or_path, 'use_schema', use_schema); + layout = bids.layout(layout_or_path, ... + 'use_schema', use_schema, ... + 'index_dependencies', false, ... + 'tolerant', tolerant, ... + 'verbose', verbose); subjects_list = bids.query(layout, 'subjects'); @@ -126,7 +130,7 @@ 'acq_time', {cell(numel(data), 1)}, ... 'comments', {cell(numel(data), 1)}); - output_filenames{end + 1} = scans_file; %#ok + output_filenames{end + 1} = scans_file; bids.util.tsvwrite(fullfile(layout.pth, scans_file), content); diff --git a/tests/data/reports/ds000117_anat.md b/tests/data/reports/ds000117_anat.md index 72e86b9c..dbd27395 100644 --- a/tests/data/reports/ds000117_anat.md +++ b/tests/data/reports/ds000117_anat.md @@ -4,7 +4,7 @@ ### Anatomical Magnetic Resonance Imaging data -#### T1-weighted image +#### Fast-Low-Angle-Shot image The data acquisition was performed in the {{InstitutionName}}, {{InstitutionalDepartmentName}}, {{InstitutionAddress}}. @@ -15,10 +15,12 @@ The software version was {{SoftwareVersions}}. {{PulseSequenceType}} {{ScanningSequence}} {{SequenceVariant}} FLASH structural MRI data were collected ({{nb_slices}} slices; repetition time, TR= {{RepetitionTime}} -s; echo time, TE= {{echo_time}} ms; flip angle, FA= {{FlipAngle}} deg; field +s; echo time, TE= {{echo_time}} s; flip angle, FA= {{FlipAngle}} deg; field of view, FOV= {{fov}} mm; matrix size= {{mat_size}}; voxel size= {{vox_size}} mm). +#### T1-weighted image + The data acquisition was performed in the MRC Cognition and Brain Sciences Unit, {{InstitutionalDepartmentName}}, 15 Chaucer Road, Cambridge CB2 7EF, UK. diff --git a/tests/tests_utils/test_create_scans_tsv.m b/tests/tests_utils/test_create_scans_tsv.m index 89222c22..1424cf84 100644 --- a/tests/tests_utils/test_create_scans_tsv.m +++ b/tests/tests_utils/test_create_scans_tsv.m @@ -8,7 +8,11 @@ function test_create_scans_tsv_basic_no_session() - bids_path = fullfile(get_test_data_dir(), 'asl001'); + source_ds = fullfile(get_test_data_dir(), 'asl001'); + tmp_path = temp_dir(); + copyfile(source_ds, tmp_path); + + bids_path = fullfile(tmp_path); validate_dataset(bids_path); @@ -21,31 +25,25 @@ function test_create_scans_tsv_basic_no_session() validate_dataset(bids_path); - teardown(bids_path, output_filenames); - end function test_create_scans_tsv_basic() - bids_path = fullfile(get_test_data_dir(), 'ds000117'); + source_ds = fullfile(get_test_data_dir(), 'ds006'); + tmp_path = temp_dir(); + copyfile(source_ds, tmp_path); + + bids_path = fullfile(tmp_path); validate_dataset(bids_path); output_filenames = bids.util.create_scans_tsv(bids_path, 'verbose', false); - assertEqual(numel(output_filenames), 16); + assertEqual(numel(output_filenames), 28); assertEqual(exist(fullfile(bids_path, output_filenames{1}), 'file'), 2); content = bids.util.tsvread(fullfile(bids_path, output_filenames{1})); assertEqual(fieldnames(content), {'filename'; 'acq_time'; 'comments'}); validate_dataset(bids_path); - teardown(bids_path, output_filenames); - -end - -function teardown(pth, filelist) - for i = 1:numel(filelist) - delete(fullfile(pth, filelist{i})); - end end diff --git a/tests/utils/validate_dataset.m b/tests/utils/validate_dataset.m index b5c71e07..ef23a27f 100644 --- a/tests/utils/validate_dataset.m +++ b/tests/utils/validate_dataset.m @@ -5,6 +5,6 @@ function validate_dataset(bids_path) end [sts, msg] = bids.validate(bids_path, '--config.ignore=99 --ignoreNiftiHeaders'); - assertEqual(sts, 0); + assert(sts == 0, msg); end