Skip to content

Commit

Permalink
fix tests after merge from main
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau committed Sep 4, 2023
1 parent 0008bb7 commit ca63eaa
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
8 changes: 6 additions & 2 deletions +bids/+util/create_scans_tsv.m
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -126,7 +130,7 @@
'acq_time', {cell(numel(data), 1)}, ...
'comments', {cell(numel(data), 1)});

output_filenames{end + 1} = scans_file; %#ok<AGROW>
output_filenames{end + 1} = scans_file;

bids.util.tsvwrite(fullfile(layout.pth, scans_file), content);

Expand Down
6 changes: 4 additions & 2 deletions tests/data/reports/ds000117_anat.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}}.
Expand All @@ -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.

Expand Down
24 changes: 11 additions & 13 deletions tests/tests_utils/test_create_scans_tsv.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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
2 changes: 1 addition & 1 deletion tests/utils/validate_dataset.m
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ca63eaa

Please sign in to comment.