<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks James - Exactly what I needed. <div><br></div><div>Another question for the list about automagic channel rejection.</div><div>This picture shows some EEG and the channels that are marked as bad with kurtosis / probability thresholds of 5:</div><div><a href="http://salamander.net/stage/pastebin/autorejects.jpg">http://salamander.net/stage/pastebin/autorejects.jpg</a></div><div><br></div><div>You will notice it doesn't remove channels that are wildly out of range - even dropping the thresholds on the methods to 2 or under, those extremely bad channels aren't "caught"... </div><div><br></div><div>Anyone have an idea why?</div><div><br></div><div>Best,</div><div>Andrew</div><div><br></div><div><div><div>On May 9, 2011, at 6:10 AM, James Desjardins wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi Andrew,<br><br>The outputs listed in the pop_rejchan help text can be added following <br>the EEG output at the command line as follows:<br><br>[EEG,indelec] = pop_rejchan(EEG,'elec',1:64], ...<br>'threshold',5,'norm','on','measure','kurt');<br><br>Then used in eeg_interp as follows:<br>EEG = eeg_interp(EEG,indelec)<br><br><br>Also, it may be good practice to store that vector in the EEG <br>structure so you can keep the information when you subsequently save <br>the dataset. Other rejection variables are stored in the EEG.reject <br>field.<br><br>The following should work nicely and the marked channels will be <br>stored when you save the dataset:<br><br>[EEG,EEG.reject.indelec] = pop_rejchan(EEG,'elec',1:64], ...<br>'threshold',5,'norm','on','measure','kurt');<br><br>EEG = eeg_interp(EEG,EEG.reject.indelec)<br><br><br>I have been using a procedure similar to this in my data processing <br>stream where I interpolate bad channels then include them in my <br>average reference (the interpolation allows for a consistent and <br>spatially balanced average reference channel across participants <br>regardless of what channels are marked bad). I keep track of which <br>channels have been interpolated (in the case above using the <br>EEG.reject.indelect field) and then I do not include them in <br>procedures where interpolation is inappropriate (eg. ICA).<br><br>I hope that this is helpful.<br><br>ps. I am going to use the term "automagically" regularly from now on.<br><br>James Desjardins<br>Technician, MA Student<br>Department of Psychology, Behavioural Neuroscience<br>Cognitive and Affective Neuroscience Lab<br>Brock University<br>500 Glenridge Ave.<br>St. Catharines, ON, Canada<br>L2S 3A1<br>905-688-5550 x4676<br><br><br>Quoting Andrew Hill <<a href="mailto:andrewhill@ucla.edu">andrewhill@ucla.edu</a>>:<br><br><blockquote type="cite">Hi folks,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I'm trying to figure out how to first automagically detect bad <br></blockquote><blockquote type="cite">channels and then interpolate them on the fly, before saving my EEG <br></blockquote><blockquote type="cite">data set.<br></blockquote><blockquote type="cite">Using pop_rejchan seems to do what it should:<br></blockquote><blockquote type="cite">...<br></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">EEG = pop_rejchan(EEG ,'threshold',5,'norm','on','measure','kurt');<br></blockquote></blockquote></blockquote><blockquote type="cite">Computing kurtosis for channels...<br></blockquote><blockquote type="cite">4 electrodes labeled for rejection<br></blockquote><blockquote type="cite">Removing 4 channel(s)...<br></blockquote><blockquote type="cite">...<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">But these are of course not removed - just marked as red in the plot <br></blockquote><blockquote type="cite"> and I'm assuming labeled in the EEG object somewhere.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I see an output parameter "indelec" in the pop_rejchan help, but <br></blockquote><blockquote type="cite">after running pop_rejchan I don't see an "indelec" variable created, <br></blockquote><blockquote type="cite"> nor a EEG.indelec one.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Ideally I'd like to take the indices of any marked-bad channels and <br></blockquote><blockquote type="cite">then immediately interpolate, maybe something like this?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">EEG = pop_rejchan(EEG, 'elec',[1:64] <br></blockquote><blockquote type="cite">,'threshold',5,'norm','on','measure','kurt');<br></blockquote><blockquote type="cite">EEG = eeg_interp(EEG, EEG.indelec)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">But that of course isn't syntatically correct - how/where is this <br></blockquote><blockquote type="cite">information stored?<br></blockquote><blockquote type="cite">Is anyone else doing something like this?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Also, does the pop_reref function know enough to exclude channels <br></blockquote><blockquote type="cite">that have been marked bad?<br></blockquote><blockquote type="cite">I couldn't see anything relevant in the function help.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Thanks,<br></blockquote><blockquote type="cite">Andrew<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">Eeglablist page: <a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html">http://sccn.ucsd.edu/eeglab/eeglabmail.html</a><br></blockquote><blockquote type="cite">To unsubscribe, send an empty email to <a href="mailto:eeglablist-unsubscribe@sccn.ucsd.edu">eeglablist-unsubscribe@sccn.ucsd.edu</a><br></blockquote><blockquote type="cite">For digest mode, send an email with the subject "set digest mime" to <br></blockquote><blockquote type="cite"> <a href="mailto:eeglablist-request@sccn.ucsd.edu">eeglablist-request@sccn.ucsd.edu</a><br></blockquote><blockquote type="cite"><br></blockquote><br><br><br><br>_______________________________________________<br>Eeglablist page: <a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html">http://sccn.ucsd.edu/eeglab/eeglabmail.html</a><br>To unsubscribe, send an empty email to <a href="mailto:eeglablist-unsubscribe@sccn.ucsd.edu">eeglablist-unsubscribe@sccn.ucsd.edu</a><br>For digest mode, send an email with the subject "set digest mime" to <a href="mailto:eeglablist-request@sccn.ucsd.edu">eeglablist-request@sccn.ucsd.edu</a><br></div></blockquote></div><br></div></body></html>