[FieldTrip] Replacing artifacts part by nan value

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Tue Aug 8 11:21:06 CEST 2023


Hi Erfan,

Could it be that there is a typo here?

cfg.artifactdef = cfg_artfctdef -> cfg.artfctdef = cfg_artfctdef;

Best wishes,
Jan-Mathijs

On 24 Jul 2023, at 08:43, Erfan Vi via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Dear FieldTrip users,
I use the  ArtifactMEG.zip<https://urldefense.com/v3/__https://download.fieldtriptoolbox.org/tutorial/ArtifactMEG.zip__;!!HJOPV4FYYWzcc1jazlU!4vKXD91CTmKqghFOD3Hgu_P6uxQdXXMKO4yQwwLLlgsOkdwBZ385rFZK23er0FM8P4cEUSNk0NW_7HzsUvmxaFOIew$> example MEG dataset and code in the link https://urldefense.com/v3/__https://www.fieldtriptoolbox.org/tutorial/ica_artifact_cleaning/__;!!HJOPV4FYYWzcc1jazlU!_aXRr77Uux4V-eB8IuSm6NcnB5vHlnEYryCQdFUpJiWZOdG1kLZ3H8Tb8RjHcYKkxbpXEMctvljNPIZmZLEjb9UGzfGWxnfiWnhqUA$ <https://urldefense.com/v3/__https://www.fieldtriptoolbox.org/tutorial/ica_artifact_cleaning/__;!!HJOPV4FYYWzcc1jazlU!4vKXD91CTmKqghFOD3Hgu_P6uxQdXXMKO4yQwwLLlgsOkdwBZ385rFZK23er0FM8P4cEUSNk0NW_7HzsUvmxQBI3Lw$> to remove the artifact as follows:
cfg = [];
cfg.continuous = 'yes';
cfg.blocksize = 60;
cfg.plotevents = 'no';
cfg.preproc.demean  = 'yes';
cfg.layout = 'CTF151.lay';
cfg = ft_databrowser(cfg, data);
cfg_artfctdef = cfg.artfctdef;

cfg = [];
cfg.artifactdef = cfg_artfctdef;
cfg.artfctdef.reject = 'nan';
data_clean = ft_rejectartifact(cfg, data);

For two reasons, the specified regions of the artifact are not replaced by the null value:
1) The output printed in the command window is:
rejected   0 trials completely
rejected   0 trials partially
filled parts of   0 trials with NaNs
filled parts of   0 trials with the specified value
resulting   1 trials
the call to "ft_rejectartifact" took 1 seconds
2) When I use the ft_databrowser function again for data_clean, basically the areas replaced with the null value should be invisible, which is not the case.
Can anyone explain to me what's the problem?
Thank you,
Erfan Vajdi
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!5Elnov9n-jvdLZPJJ37SCY8838Vwb8g8vIJRVIkVY7LptSOmvV34t0KzX4srA9AfkpIhoWGHJfaHl0EV3aOz5ftlbI0xDb1XBiTiPA$

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


More information about the fieldtrip mailing list