Back to the main page.

Bug 2590 - implement ft_removetemplateartifact function for Tom's TDCS artifacts

Reported 2014-05-23 12:07:00 +0200
Modified 2014-05-23 13:18:46 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P5 normal
Assigned to: Robert Oostenveld
Depends on:
See also:

Robert Oostenveld - 2014-05-23 12:07:54 +0200

as discussed in the EDA

Robert Oostenveld - 2014-05-23 13:18:46 +0200

Hi Tom, I could not find the old code, so I reimplemented it. mac011> svn commit ft_removetemplateartifact.m test/test_bug2590.m ft_removetmsartifact.m ft_examplefunction.m Sending ft_examplefunction.m Adding ft_removetemplateartifact.m Sending ft_removetmsartifact.m Adding test/test_bug2590.m Transmitting file data .... Committed revision 9587. Can you have a look at the example/test script test_bug2590 and see whether it makes sense? Regarding the detection of the ECG artefacts: I initially did it with feedback=yes, and subsequently fixed the parameters in the test script and switched to feedback=no. I think that the example already demonstrates some suboptimal features, e.g. when the template is not so clean. E.g. if you run it on all data (not only the first 60 seconds), there is a noisy section in the middle, and the very last piece of the data is messy. Those are best dealt with prior to computing the averaged template, otherwise the template is suboptimal of course. Room for improvement is fitting the template to the data (e.g. assuming that its amplitude fluctuates) and allowing for some time-shifting of a few samples (assuming that the artefact detection is not 100% timing correct). But I guess that this should be good enough to get started with, esp. because the beamformer is to follow. One issue (specific to the test script) is that the first heartbeat is not detected and hence not cleaned. Not a fault of the new function, but a limitation of ft_artifact_ecg. Another issue that might need to be improved is that the channel order gets mixed up inside the ft_removetemplateartifact function. The mapping between channels and rows remains correct, but it is annoying when using the plot() function.