% Adds a context.tsv file for each vaso file % specifying the volume type of each volume % % requires bids-matlab: https://github.com/bids-standard/bids-matlab % % clear; root_dir = fullfile(fileparts(mfilename('fullpath')), '..'); % this is hard coded here % but obviously would have to be adapted dynamically to each file volume_order = {'non_nulled'; 'nulled'}; AcquisitionDuration nb_volumes = 200; %% BIDS = bids.layout(root_dir, 'use_schema', false); files = bids.query(BIDS, 'data', 'suffix', 'vaso'); for i = 1:numel(files) context = struct('volume_type', {{}}); context_filename = bids.File(files{i}); context_filename.extension = '.tsv'; context_filename.suffix = 'context'; context.volume_type = repmat(volume_order, nb_volumes / numel(volume_order), 1); output_file = fullfile(BIDS.pth, ... context_filename.bids_path, ... 'func', ... context_filename.filename); bids.util.tsvwrite(output_file, context); end