Skip to content

Commit

Permalink
prepare mrs
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau committed Aug 2, 2024
1 parent 9725f37 commit 55ba3d3
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ manual:
cd docs && sh create_manual.sh

update_schema:
wget https://bids-specification.readthedocs.io/en/latest/schema.json -O schema.json
wget https://bids-specification--1377.org.readthedocs.build/en/1377/schema.json -O schema.json
# wget https://bids-specification.readthedocs.io/en/latest/schema.json -O schema.json
# get schema from a PR on the spec
2 changes: 1 addition & 1 deletion schema.json

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions tests/tests_query/test_bids_query_mrs.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
function test_suite = test_bids_query_mrs %#ok<*STOUT>
try % assignment of 'localfunctions' is necessary in Matlab >= 2016
test_functions = localfunctions(); %#ok<*NASGU>
catch % no problem; early Matlab versions can use initTestSuite fine
end
initTestSuite;
end

function test_bids_query_asl_basic_2dmrsi()

BIDS = bids.layout(fullfile(get_test_data_dir(), 'mrs_2dmrsi'));

modalities = {'anat', 'mrs'};
assertEqual(bids.query(BIDS, 'modalities'), modalities);

suffixes = {'T1w', 'mrsi'};
assertEqual(bids.query(BIDS, 'suffixes'), suffixes);

assertEqual(numel(bids.query(BIDS, 'data')), 32);

filename = bids.query(BIDS, 'data', 'sub', '01', 'suffix', 'mrsi');
basename = bids.internal.file_utils(filename, 'basename');
assertEqual(basename, { 'sub-01_run-1_mrsi.nii'
'sub-01_run-2_mrsi.nii'
'sub-01_run-3_mrsi.nii'});

end

function test_bids_query_asl_basic_biggaba()

BIDS = bids.layout(fullfile(get_test_data_dir(), 'mrs_biggaba'));

modalities = {'anat', 'mrs'};
assertEqual(bids.query(BIDS, 'modalities'), modalities);

suffixes = {'T1w', 'mrsref', 'svs'};
assertEqual(bids.query(BIDS, 'suffixes'), suffixes);

assertEqual(numel(bids.query(BIDS, 'data')), 84);

end

function test_bids_query_asl_basic_fmrs()

BIDS = bids.layout(fullfile(get_test_data_dir(), 'mrs_fmrs'));

modalities = {'anat', 'mrs'};
assertEqual(bids.query(BIDS, 'modalities'), modalities);

suffixes = { 'T1w', 'events', 'mrsref', 'svs'};
assertEqual(bids.query(BIDS, 'suffixes'), suffixes);

assertEqual(numel(bids.query(BIDS, 'data')), 90);

metadata = bids.query(BIDS, 'metadata', 'sub', '01', 'suffix', 'svs');

metadata{1}.ReferenceSignal;
bids.internal.resolve_bids_uri(metadata{1}.ReferenceSignal, BIDS);

end

0 comments on commit 55ba3d3

Please sign in to comment.