CSC-UW / csc-eeg-tools

Set of matlab functions for EEG io, preprocessing, analysis from the Center for Sleep and Consciousness, University of Wisconsin (csc)
19 stars 7 forks source link

bad section rejection with csc_eeg_plotter #17

Closed rverhagen closed 7 years ago

rverhagen commented 7 years ago

Dear,

in the past I have been rejecting bad sections/regions with eeglab. However, this method is too slow. I am hoping it is possible to do this with csc_eeg_plotter. However, it seems I can't select regions anymore (turning the signal into red), which the plotter was able to do a while ago. Using events might work, but when displaying many (>50) channels the plotter can't put in events, and also placing events at the very beginning and end of an epoch is tricky. Any suggestions?

Best,

Ruben

Mensen commented 7 years ago

I only use the csc_eeg_plotter for marking artefacts. I use events 1 and 2 (which can be quickly placed using the keyboard keys 1, and 2, placing the event whereever the mouse is).

Once I've made my markings I use the following commands to remove that data (another aside, I would recommend not actually removing the data as detailed below but simply keeping another variable with the segments marked):

% remove epochs
event_starts = cellfun(@(x) strcmp(x, 'event 1'), EEG.csc_event_data(:, 1));

% sanity check for artifact event markers
if sum(event_starts) ~= sum(~event_starts)
   fprintf('\nWarning: uneven number of events, check event_data\n'); 
end

% use EEGLAB to remove the points
EEG.bad_segments{1} = [cell2mat(EEG.csc_event_data(event_starts, 2)), ...
    cell2mat(EEG.csc_event_data(~event_starts, 2))];

% convert the timing from seconds to samples
EEG.bad_segments{1} = floor(EEG.bad_segments{1} * EEG.srate);

% use EEGLAB to remove the regions
EEG = pop_select(EEG, 'nopoint', EEG.bad_segments{1});

I still mark events when viewing even 96 channels, so not sure what you mean by (>50)?

If you have trouble marking at the start and end of any window, you can just jump a little ahead (or behind) in time using the ctrl (or alt) modifier key and then pressing the arrows as usual.

I'm also pretty sure the csc_eeg_plotter never had a mouse drag select function because this sort of thing started to break and cause errors in newer Matlab versions > 2015.

rverhagen commented 7 years ago

Thank you! That helps a lot!