123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- % Adds a single events.tsv to the dataset
- %
- % requires bids-matlab: https://github.com/bids-standard/bids-matlab
- %
- %
- % timings in of the individual movie clips within the 15 min
- %
- % rest1 0:4
- % clip1 4:50
- % rest2 50:55
- % clip2 55:96
- % rest3 96:101
- % clip3 101:137
- % rest4 137:142
- % clip4 142:153
- % rest5 153:158
- % clip5 158:173
- % rest6 173:180
- % This is given in units of TRs.
- % These numbers refer to periods.
- % I.e. 0:4 = [0, 1, 2, 3]
- clear;
- timings = {'clip1', 4,50;
- 'clip2', 55,96;
- 'clip3', 101,137;
- 'clip4', 142,153;
- 'clip5', 158,173};
- % this is hard coded here
- % but obviously would have to be adapted dynamically to each file
- TRs = [5.1002; 5.1999];
- nb_volumes = 200;
- VolumeTiming = cumsum([0; repmat(TRs, nb_volumes / numel(TRs), 1)]);
- %%
- root_dir = fullfile(fileparts(mfilename('fullpath')), '..');
- filename = fullfile(root_dir, 'task-movie_events.tsv');
- % approximate duration by taking means of TR X number of TR for that clip
- tsv_content.onset = VolumeTiming([timings{:,2}] + 1);
- tsv_content.duration = [timings{:,3}] - [timings{:,2}] * mean(TRs);
- tsv_content.trial_type = repmat({'clip'}, size(timings, 1), 1);
- tsv_content.clip_number = 1:size(timings, 1);
- bids.util.tsvwrite(filename, tsv_content);
|