The main function is to facilitate âqueriesâ to a BIDS dataset
Say you have some fMRIprep output on a dataset that contains 3 âtasksâ (seeingFaces
, seeingHouses
, rest
), with 30 subjects, normalized in 2 different spaces (T1w
, MNI
), that the same protocol was done on 2 sessions (ses-1
and ses-2
) that you have 10 runs for each participant.
How do you âselectâ (when scripting) only the preprocessed files, their corresponding TSV, their confounds (realignement parameters and others) to build your GLM, for subject 7 and 15, of the session 2 for run 3 and 8 in T1w space for the seeingFaces
?
% index fmriprep data to get BOLD and confounds
BIDS = bids.layout(path_to_fmriprep_data);
% query for the right files
bold_files = bids.query(BIDS, 'data', ...
'sub', {'07', '15'}, ...
'ses', '2', ...
'space', 'T1w', ...
'task', 'seeingFaces', ...
'run', {'03', '08}, ...
'desc', 'preproc', ...
'suffix', 'bold');
confound_files = bids.query(BIDS, 'data', ...
'sub', {'07', '15'}, ...
'ses', '2', ...
'space', 'T1w', ...
'task', 'seeingFaces', ...
'run', {'03', '08}, ...
'suffix', 'timeseries');
% index raw data to get events.tsv files
BIDS = bids.layout(path_to_raw_data);
events_files = bids.query(BIDS, 'data', ...
'sub', {'07', '15'}, ...
'ses', '2', ...
'task', 'seeingFaces', ...
'run', {'03', '08}, ...
'suffix', 'events');
In the lab where I work we use bids-matlab a lot to build our SPM pipelines
See there GitHub - cpp-lln-lab/CPP_SPM: code base for SPM-based analysis with BIDS datasets