[FieldTrip] Artefact rejection & ICA on continuous data followed by segmentation

Sebastian Michelmann SXM1085 at student.bham.ac.uk
Tue May 17 18:37:16 CEST 2016


Hi Christine,
I'm sure that there is a "clean" fieldtrip way to solve your problem which should be the preferred solution. However here is an idea for debugging and a potential workaround that might help.

So ft_databrowser marks the artefacts you selected by storing the sampleinfo of the beginning and the end of you selection (these are two sampling points, counted from the beginning of your recording).
They are stored in two column vectors (look it up in cfg.artfctdef.visual).

I think something might have gone wrong when you cut your data because fieldtrip eventually removes and/or reconstructs sampleinfo if it is inconsistent or missing (don't ask me how and when this does and does not happen).
So my guess for debugging would be: check at every step, what happens to your data.sampleinfo. It's also worth to read through the command line output because you should get a warning if something funny is going on.

If you know your sampleinfo to be correct, here a workaround you might want to try:

% 1st Manually read out the trials that contain artifacts (right after you marked them: cfg_art= ft_databrowser(cfg, data));

a_trials =[]; % trials with artifacts
artifacts=cfg_art.artfctdef.visual; % info about the artifacts
for n=1:size(artifacts.artifact,1)
    a_trials = [a_trials;find(data.sampleinfo(:,1) <= artifacts.artifact(n,1) ...
        & data.sampleinfo(:,2) >= artifacts.artifact(n,1))]; %concatenate the trials that contain artifacts
end

% find out which trials are artefact free
trials=1:numel(data.trial); % all the trials
trialsel=find(~ismember(trials,a_trials)); % the selected trials are trials that are not member of the artifact trials

% Call ft_preprocessing (or ft_selectdata...) to select only the artefact free trials.

cfg=[];
cfg.trials=trialsel;
data_clean = ft_selectdata(cfg, data);

I hope that helps.
Best,
Sebastian

From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Blume Christine
Sent: 13 May 2016 07:23
To: fieldtrip at science.ru.nl
Subject: [FieldTrip] Artefact rejection & ICA on continuous data followed by segmentation

Dear community,

I would like to do the following steps, however fieldtrip does not seem to like this in my case:


1.      Artefact rejection on continuous data using ft_databrowser as I do not like ft_rejectvisual's visualization (needs to be done on continuous data as I will have overlapping segments once I segment, which is not supported by ft_databrowser). Calling ft_rejectartifact following that procedure to exclude major artefacts before ICA.

2.      ICA on cleaned continuous data, mainly to remove EOG artefacts

3.      Another round of manual/visual artefact rejection on cleaned/eog-rejected continuous data using ft_databrowser visualization (again, needs to be done on continuous data as I will have overlapping segments once I segment, which is not supported by ft_databrowser)

4.      Segmentation of cleaned data

I am experiencing problems with the artefact rejection (1) and the following segmentation (4), though. It works fine if I segment my data using ft_redefinetrial and then call ft_rejectartifact with the cfg returned from the (first) call to ft_databrowser. However, if I reject artefacts first and then try to apply ft_redefinetrial to the cleaned data, "bad" trials are not excluded.

Any ideas how to solve this are highly appreciated.

Best,
Christine



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160517/7723b199/attachment-0002.html>


More information about the fieldtrip mailing list