Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
30 changes: 17 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,14 @@

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);
if bids.internal.is_octave()
bids_path = fullfile(tmp_path, 'asl001');
else
bids_path = tmp_path;
end

validate_dataset(bids_path);

Expand All @@ -21,31 +28,28 @@ 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);
if bids.internal.is_octave()
bids_path = fullfile(tmp_path, 'ds006');
else
bids_path = tmp_path;
end

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