[FieldTrip] ICA - problem with ft_rejectcomponent

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Mon Mar 28 17:45:09 CEST 2022


Hi Anqi,

in order for the readership of this list to be able to help you solve your problem, it might be useful if you provide us at least with the following information:

- the error message(s) you get.
- which version of the code is giving you problems.
- which version of the code does not give you problems.

Best wishes,
Jan-Mathijs


On 27 Mar 2022, at 23:38, Lei, A. (Anqi) via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Hello,

I'm new to Fieldtrip and I encountered a problem in ICA – after rejecting bad components with ft_rejectcomponent I noticed my data can't be plotted by databrowser anymore, but before this step it can be visualized just fine. This is how I am perform ICA – is there something wrong in the ft_rejectcomponent part? Thank you for your help!


    %% ICA
    % perform the independent component analysis (i.e., decompose the data), downsampling first
    cfg            = [];
    cfg.resamplefs = 150;
    cfg.detrend    = 'no';
    data           = ft_resampledata(cfg, data_all);

    cfg        = [];
    cfg.method = 'runica'; % this is the default and uses the implementation from EEGLAB
    comp = ft_componentanalysis(cfg, data);

    %Identify components reflecting eye artifacts
    % plot the components for visual inspection
    figure
    cfg = [];
    cfg.component = 1:20;       % specify the component(s) that should be plotted
    cfg.layout    = 'acticap-64ch-standard2_XZ.mat'; % specify the layout file that should be used for plotting
    cfg.comment   = 'no';
    ft_topoplotIC(cfg, comp)

    %Further inspection of time course of component
    cfg = [];
    cfg.layout = 'acticap-64ch-standard2_XZ.mat'; % specify the layout file that should be used for plotting
    cfg.viewmode = 'component';
    ft_databrowser(cfg, comp)

    %Removing bad artifacts and backprojecting data
    cfg = [];
    cfg.component = 1; % to be removed component(s)
    data_all = ft_rejectcomponent(cfg, comp, data_all);

Best,
Anqi

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!9pPZAj-orxSMLThTWLYj_EoBsS-_sfR6omH4Ea-iYCjE-hYVG6WkOfFdstgOBILrmb4OxZ1HYfCgpHispeJkrWvRJA3pRgxyOntpbA$

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220328/a1673d1e/attachment.htm>


More information about the fieldtrip mailing list