<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof">
Dear Fieldtrippers,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof">
I am trying to implement an automatic artifact rejection on epoched data. </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof">
The aim of this process would be to compare the same dataset, analyzed both in fieldtrip and eeglab. To do so, I would need to efficiently implement the same EEGLAB parameters used for the artifact rejection in fieldtrip. </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof">
I have two options</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof">
<div><span>
<div style="font-size:11pt;margin:0px">
<div>
<ol>
<li><span><span style="margin:0px" class="ContentPasted0">eliminate the trials based on a</span></span> peak-to-peak artifact rejection, which detects and remove trials in which the EEG signal exceeds of a threshold of 100 microvolt</li></ol>
<ol start="2">
<li><span>eliminate the trials based on simple threshold voltage, that is, eliminate trials in which the voltage exceeds of +- 50 microvolts.</span><br>
</li></ol>
</div>
</div>
</span></div>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3">
Both options would be fine as both are implemented in eeglab, but I do not manage to implement neither of the two into fieldtrip.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3">
I've tried to use both ft_artifact_threshold and ft_rejectartifact, even by combining the two.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3">
ft_rejectartifact is not able not detect artifacts in the data, the output is always :</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3 ContentPasted8">
%artifact rejection
<div class="ContentPasted8">cfg = [];</div>
<div class="ContentPasted8">cfg.artfctdef.channel = [1:28 31:65];</div>
<div class="ContentPasted8">cfg.artfctdef.threshold.min = -50;</div>
<div class="ContentPasted8">cfg.artfctdef.threshold.max = 50;</div>
<div class="ContentPasted8">cfg.artfctdef.prestim = -0.1;</div>
<div class="ContentPasted8">cfg.artfctdef.poststim = 0.6;</div>
<div class="ContentPasted8">cfg.artfctdef.window = 'trial';</div>
data_clean = ft_rejectartifact(cfg, clean_data);<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3 ContentPasted8">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3 ContentPasted7">
the call to "ft_preprocessing" took 111 seconds
<div class="ContentPasted7">rejected 0 trials completely</div>
<div class="ContentPasted7">rejected 0 trials partially</div>
<div class="ContentPasted7">filled parts of 0 trials with NaNs</div>
<div class="ContentPasted7">filled parts of 0 trials with zeros</div>
filled parts of 0 trials with a specified value <br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3 ContentPasted7">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3 ContentPasted7">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3">
<span style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">This is an example of what I get when using the functions together..</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3">
<span style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3">
<span style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">cfg = [];</span><br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3 ContentPasted4">
<div class="ContentPasted4">cfg.continuous = 'no';</div>
<div class="ContentPasted4">cfg.artfctdef.channel = {'all', '-ECG1', '-ECG2', '-IO'};</div>
<div class="ContentPasted4">cfg.dataset =clean_data.trial(:,:);</div>
<div class="ContentPasted4">% cfg.artfctdef.threshold.min = -50;</div>
<div class="ContentPasted4">% cfg.artfctdef.threshold.max = 50;</div>
<div class="ContentPasted4">% cfg.artfctdef.threshold.range=100;</div>
<div class="ContentPasted4">cfg.artfctdef.prestim = -0.1;</div>
<div class="ContentPasted4">cfg.artfctdef.poststim = 0.6;</div>
<div class="ContentPasted4">cfg.trl=trl;</div>
<div class="ContentPasted4">[~, artData] = ft_artifact_threshold(cfg, clean_data);</div>
<div><br class="ContentPasted4">
</div>
<div class="ContentPasted4">cfg = [];</div>
<div class="ContentPasted4">cfg.artfctdef.xxx.artifact = artData;</div>
<div class="ContentPasted4">cfg.artfctdef.reject = 'complete';</div>
<div class="ContentPasted4">fnData = ft_rejectartifact(cfg, clean_data);</div>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3 ContentPasted4">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3 ContentPasted5">
The output seems to not be able to read the trials information, as it does not mark the trials but only segments in which there are artifacts: </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3 ContentPasted5">
searching for artifacts in 65 channels
<div class="ContentPasted5">applying preprocessing options</div>
<div class="ContentPasted5">searching in trial 643 from 643</div>
<div class="ContentPasted5">detected 7172 artifacts</div>
the call to "ft_artifact_threshold" took 25 seconds</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3 ContentPasted5 ContentPasted6">
>>
<div class="ContentPasted6">cfg = [];</div>
<div class="ContentPasted6">cfg.artfctdef.xxx.artifact = artData;</div>
<div class="ContentPasted6">cfg.artfctdef.reject = 'complete';</div>
<div class="ContentPasted6">fnData = ft_rejectartifact(cfg, clean_data);</div>
<div class="ContentPasted6">detected 1 xxx artifacts</div>
<div class="ContentPasted6">Index in position 2 exceeds array bounds. Index must not exceed 1.</div>
<div><br class="ContentPasted6">
</div>
<div class="ContentPasted6">Error in ft_rejectartifact (line 305)</div>
endsample = artifact{i}(:,2);<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3">
Please help me!!</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof ContentPasted1 ContentPasted3">
Any support is appreciated <br>
Thank you very much </div>
<div class="elementToProof">
<div id="Signature">
<div>
<div></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<span style="margin: 0px; font-size: 16px; font-family: Calibri, Arial, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; text-align: start; background-color: white;"><font size="2" face="Calibri,Arial,Helvetica,sans-serif" style="color: rgb(117, 123, 128);"><span style="margin:0px"><b><font size="2" style="color: rgb(117, 123, 128);"><span style="margin:0px; font-size:11pt"><span style="margin: 0px; font-size: 13.31px; font-family: Calibri, sans-serif; color: rgb(222, 106, 25);">Eleonora
Parrotta, Doctoral Researcher in Social Neuroscience </span></span></font></b></span></font></span>
<div style="margin: 0px; font-size: 16px; font-family: Calibri, Arial, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; text-align: start; background-color: white;">
<span style="color: rgb(222, 106, 25);"></span><font size="2" face="Calibri,Arial,Helvetica,sans-serif" style="color: rgb(117, 123, 128);"><span style="margin:0px"><font size="2" style="color: rgb(117, 123, 128);"><span style="margin:0px; font-size:11pt"><span style="margin: 0px; font-size: 13.31px; font-family: Calibri, sans-serif; color: purple;">
<div style="margin:0px"><span style="margin: 0px; color: rgb(117, 123, 128);"><span style="margin: 0px; font-size: 13.32px; font-family: Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont; color: rgb(51, 51, 51); background-color: white;">School of Psychology</span><span> </span>|
University of Aberdeen | Aberdeen |<span> </span><span style="margin: 0px; font-size: 13.32px; font-family: Arial, sans-serif, serif, EmojiFont; color: rgb(51, 51, 51); background-color: white;">AB24 3FX</span></span></div>
<span style="margin:0px"><span style="margin: 0px; color: rgb(117, 123, 128);"><span style="margin: 0px; font-size: 13.32px; font-family: Arial, sans-serif, serif, EmojiFont; color: rgb(51, 51, 51); background-color: white;"><span style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif, serif, EmojiFont; background-color: white;"><span style="margin:0px">e.parrotta.20@abdn.ac.uk</span></span></span></span></span></span></span></font></span></font></div>
<br>
</div>
</div>
</div>
</div>
</body>
</html>