<div>Dear Lennart,</div>
<div> </div>
<div>Thank you for your reply. It is really useful.</div>
<div> </div>
<div>Let me play a bit with it and will let you know if I have further problems.</div>
<div> </div>
<div>Thanks again,</div>
<div> </div>
<div>Davide<br><br></div>
<div class="gmail_quote">On Mon, Jan 9, 2012 at 7:44 PM, Verhagen, L. (Lennart) <span dir="ltr"><<a href="mailto:l.verhagen@fcdonders.ru.nl">l.verhagen@fcdonders.ru.nl</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">Dear Davide,<br><br>Currently, there is no dedicated processing pipeline available in<br>FieldTrip that will allow you to remove TMS artifacts from EEG data.<br>
However, I have been using FieldTrip to analyze TMS-EEG data for the past<br>two years (with success), so I am happy to give you some advice.<br><br>Please remember that the difference between "good" and "bad" TMS-EEG data<br>
will not be made by FieldTrip (or any other analysis package), but by your<br>data acquisition.<br><br>There are a number of artifacts which are dealt with in different ways:<br>the pulse itself, clipping, ringing step-response of the op-amp, decay of<br>
the RC-circuit in the filters of the amplifier, decay of the<br>scalp-electrolyte-electrode circuit, muscle twitch, TMS recharging<br>artifact, auditory evoked response, somatosensory evoked response.<br><br>1. Pulse: The data during the pulse (e.g. 0.3 ms) is lost and cannot be<br>
recovered.<br>2. Clipping: Only the Nexstim amplifier is currently theoretically able to<br>hold-and-clamp your data acquisition. In all other amplifiers the signal<br>will go out-of-range ("clip") between 2-6 ms, depending on your setup. In<br>
this time-period, your data is lost. Some people like to interpolate their<br>data over the missing values. I personally don't like that.<br>3. Following the clipping of the data your operational amplifier circuit<br>
will be subject to a step-response. This is a characteristic ringing<br>artifact often lasting up to 10 ms. You can put a lot of effort in<br>modeling this artifact (search for "Kalman filter"), but I personally have<br>
not seen any modeling/filtering that worked adequately. Therefore many<br>people consider the first 8-10 ms following the TMS pulse as lost. Some<br>interpolate, I replace the values by NaNs.<br>4. Decay step-response. You are very likely to also observe a decay<br>
artifact in some channels, resembling an exponential decay. This decay can<br>last relatively long. In horrible cases even up to 1 second, but a decay<br>lasting 50-150 ms is not uncommon. I have addressed this artifact by<br>
developing an constrained iterative fitting algorithm that is capable of<br>modeling four additive exponential decays with different time constants.<br>This worked reasonable well for my data, but has not been tested on data<br>
acquired in any other lab (or setup for that matter). If you are<br>interested, and know what you are doing, I could share my code with you<br>(ft_tms_fitexpstepresp). I plan to develop this code (and a tutorial<br>TMS-EEG processing pipeline) together with other TMS-EEG experts at the<br>
Donders, into a tested set op mfiles, which will hopefully find their<br>place in the FieldTrip distribution.<br>5. the muscle twitch is notorious and cannot be easily removed.<br>6. depending on your TMS machine, you can see a recharging artifact.<br>
Sometimes it can be horrendous, other times it is hardly visible or<br>completely absent. The best way to deal with this artifact is to avoid it.<br><br>Next to replacing values by NaNs and modeling artifacts, I have also used<br>
Independent Component Analysis to identify and remove artifacts. Please<br>keep in mind that you can only use ICA if you have already attempted to<br>clean up your data by all other means. TMS artifacts can be quite strong<br>
and show non-linear behavior. Therefore the independent components might<br>be overloaded by the extreme variance provided by the TMS pulse alone.<br><br>I hope I have helped you a bit further. I can imagine that you have more<br>
questions. If so, it would be great if you specify them clearly. I could<br>fill a whole new paper will many little tips and tricks, but that would be<br>utterly impractical. By the way, a TMS toolkit focusing on multi-modal TMS<br>
(strong emphasis on TMS-EEG) is likely to be organized by the Donders<br>early this summer, so keep an eye out on this mailing list if you are<br>interested.<br><br>Cheers,<br>Lennart.<br><br><br>> From: Davide <<a href="mailto:drivolta81@gmail.com">drivolta81@gmail.com</a>><br>
> Date: 9 January 2012 0:00:57 CET<br>> To: "<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a>" <<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a>><br>> Subject: [FieldTrip] Tms artifact removal from eeg data<br>
> Reply-To: Email discussion list for the FieldTrip project<br><<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a>><br>
<div>
<div class="h5">><br>> Dear all,<br>><br>> I just wish to ask what is a good way to remove tms artifacts from eeg<br>data using fieldtrip.<br>><br>> The artifact lasts for around 4-8 ms after the tms pulse.<br>
><br>> Thanks for your help,<br>> Davide<br></div></div>_______________________________________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Davide Rivolta, PhD<br><br>