bids-matlab-tools icon indicating copy to clipboard operation
bids-matlab-tools copied to clipboard

Add entry for stimulus folder in pop_exportbids

Open arnodelorme opened this issue 4 years ago • 4 comments

arnodelorme avatar Oct 12 '21 23:10 arnodelorme

So you do not have manually copy the folder

arnodelorme avatar Oct 18 '21 23:10 arnodelorme

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.

cll008 avatar Oct 25 '21 23:10 cll008

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 avatar Oct 25 '21 23:10 arnodelorme

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

arnodelorme avatar Oct 26 '21 00:10 arnodelorme