sccn / EEG-BIDS

21 stars 17 forks source link

Add entry for stimulus folder in pop_exportbids #89

Open arnodelorme opened 2 years ago

arnodelorme commented 2 years ago

So you do not have manually copy the folder

cll008 commented 2 years ago

Currently files are already copied via opts.stimuli but AFAIK there's no way to edit this in the GUI. It looks like the most polished way forward is to add a 'pair events and stimuli' menu item under BIDS (or a button in pop_eventinfo) which would edit EEG.events.stim_file based on EEG.event.type (basically functions like opts.stimuli during bids_export). Then we can copy files based on unique entries in EEG.events.stim_file (in this way, re-exports will also copy the stimfiles), and deprecate https://github.com/sccn/bids-matlab-tools/blob/master/bids_export.m#L519-L532

The easy way out is to add another button to locate a stimfile folder, but the code will get even messier. I'm not a fan of adding too many ways to interact with the same field (and don't think we should code in a way that can lead to this): https://github.com/sccn/bids-matlab-tools/blob/a0190d82907fc045c73a346d770616950c181e85/bids_export.m#L917

I also feel like the snippet for getAllUniqueFieldValues can be a standalone function for EEGLAB. https://github.com/sccn/bids-matlab-tools/blob/1d17c90170a0e55f5b2a644a6e5ccc1563b43272/pop_eventinfo.m#L508-L525

@dungscout96, any thoughts on how best to include this? Also those GUI editing functions are well written and neat, thanks for that.

arnodelorme commented 2 years ago

Check for field 'stimuli' in event structure and copy files

clear copyfilepersistent;

function copyfilepersistent(fileIn, fileOut)

persistent fileList;

if isempty(fileList)
    fileList = {};
end

if ismember(fileIn, fileList)
    copytfile(fileIn, fileOut)
    fileList{end+1} = fileIn;
end
arnodelorme commented 2 years ago

For the GUI. Add a new GUI to associate event types and stimuli then copy to EEG.event.stim_file for all datasets.