Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorial:automatic_artifact_rejection [2016/06/29 10:34]
robert
tutorial:automatic_artifact_rejection [2017/08/17 12:34] (current)
Line 34: Line 34:
 This procedure will result in an artifact definition, a two column array with the onset and offset sample number of every detected artifact. This '​artifact definition'​ (''​.artfctdef''​) can then, in a separate step, be used to reject (parts of) trials in your trialdefinition (so before reading the data in using ft_preprocessing for your subsequent analysis), or rejecting (parts of) data already in memory. Both methods use [[reference:​ft_rejectartifact|ft_rejectartifact]]. All the steps that the automatic artifact rejection routine takes will now be explained in detail. This procedure will result in an artifact definition, a two column array with the onset and offset sample number of every detected artifact. This '​artifact definition'​ (''​.artfctdef''​) can then, in a separate step, be used to reject (parts of) trials in your trialdefinition (so before reading the data in using ft_preprocessing for your subsequent analysis), or rejecting (parts of) data already in memory. Both methods use [[reference:​ft_rejectartifact|ft_rejectartifact]]. All the steps that the automatic artifact rejection routine takes will now be explained in detail.
  
-{{:​tutorial:​overview_artifact_detection.svg?600|}}+{{:​tutorial:​overview_artifact_detection.png?600|}}
 // Automatic artifact rejection processes the data in several steps to allow rejection of artifactual time intervals from the trial definition//​ // Automatic artifact rejection processes the data in several steps to allow rejection of artifactual time intervals from the trial definition//​
 ==== I. Reading the data (with padding) from disk ==== ==== I. Reading the data (with padding) from disk ====
Line 87: Line 87:
  
  
-{{:​tutorial:​zthreshold.svg|}}+{{:​tutorial:​zthreshold.png|}}
  
 // Setting a higher or lower z-value threshold will make the detection of artifacts more conservative or liberal// // Setting a higher or lower z-value threshold will make the detection of artifacts more conservative or liberal//
Line 97: Line 97:
 When a series of continuous timepoints are detected they are considered part of one artifact // period// and enter the artifact definition as one start and end samplenumber. Often the artifact starts a bit earlier and ends a bit later than what the artifact detection is able to capture. Artifact padding (''​cfg.artfctdef.xxx.artpadding''​) can then be used to extend the timeperiod of the artifact on both sides. This can also be used to ensure that the artifact will 'reach into' the trial that has to be rejected. ​ When a series of continuous timepoints are detected they are considered part of one artifact // period// and enter the artifact definition as one start and end samplenumber. Often the artifact starts a bit earlier and ends a bit later than what the artifact detection is able to capture. Artifact padding (''​cfg.artfctdef.xxx.artpadding''​) can then be used to extend the timeperiod of the artifact on both sides. This can also be used to ensure that the artifact will 'reach into' the trial that has to be rejected. ​
  
-{{:​tutorial:​artpadding.svg|}}+{{:​tutorial:​artpadding.png|}}
  
 //Artifact padding extends the segment of data that will be marked as artifact.// //Artifact padding extends the segment of data that will be marked as artifact.//
Line 105: Line 105:
 You might want to include segments of data preceding or following the trial, e.g. when you want to reject trials with an eye blink right before the trial onset. For this purpose trial padding (''​cfg.artfctdef.xxx.trlpadding''​) is used. Trial padding pads data on both sides of the trial with the specified length, such that artifact detection and rejection is also performed for those padded segments. You might want to include segments of data preceding or following the trial, e.g. when you want to reject trials with an eye blink right before the trial onset. For this purpose trial padding (''​cfg.artfctdef.xxx.trlpadding''​) is used. Trial padding pads data on both sides of the trial with the specified length, such that artifact detection and rejection is also performed for those padded segments.
  
-{{:​tutorial:​trlpadding.svg?600|}}+{{:​tutorial:​trlpadding.png?600|}}
  
 //​Trialpadding extends the period around the trial where artifact detection is performed// //​Trialpadding extends the period around the trial where artifact detection is performed//
Line 114: Line 114:
 To avoid that, filter padding (''​cfg.artfctdef.xxx.fltpadding''​) is used. Always in addition to trial padding (if any) existing trial padding, extra data is read on both sides prior to filtering. After the filtering has been applied, the filter padding is removed again. In other words, the filter padding is used only for filtering, not for artifact detection (see figure). To avoid that, filter padding (''​cfg.artfctdef.xxx.fltpadding''​) is used. Always in addition to trial padding (if any) existing trial padding, extra data is read on both sides prior to filtering. After the filtering has been applied, the filter padding is removed again. In other words, the filter padding is used only for filtering, not for artifact detection (see figure).
  
-{{:​tutorial:​fltpadding.svg?600|}}+{{:​tutorial:​fltpadding.png?600|}}
  
 // Filter padding. Filter padding is only used during filtering and removed afterwards. // // Filter padding. Filter padding is only used during filtering and removed afterwards. //
Line 123: Line 123:
 Filter and trial padding are often used together. Trialpadding is first added to the trial, after which filterpadding is added (and removed again after filtering has been applied). Filter and trial padding are often used together. Trialpadding is first added to the trial, after which filterpadding is added (and removed again after filtering has been applied).
  
-{{:​tutorial:​bothpadding.svg|}}+{{:​tutorial:​bothpadding.png|}}
  
 // Filter and trial padding// // Filter and trial padding//
Line 132: Line 132:
 Negative trialpadding is an option included in automatic artifact rejection because a couple of people have requested its implementation. It's a bit of a strange one and should only be applied when more appropriate steps are unavailable. This could be the case when trials have, in previous processing steps, been defined larger than necessary for artifact detection, e.g. when one has already included something similar as trial- and filter padding. Filter artifacts might then still be a problem without the possiblity of padding the data (since it is already in memory). Therefore you might want to constrain the artifact detection to a limited part of the trial, i.e. without the edges. You could then apply //​negative//​ trialpadding (using a negative value for ''​cfg.artfctdef.xxx.trlpadding''​). ​ Negative trialpadding is an option included in automatic artifact rejection because a couple of people have requested its implementation. It's a bit of a strange one and should only be applied when more appropriate steps are unavailable. This could be the case when trials have, in previous processing steps, been defined larger than necessary for artifact detection, e.g. when one has already included something similar as trial- and filter padding. Filter artifacts might then still be a problem without the possiblity of padding the data (since it is already in memory). Therefore you might want to constrain the artifact detection to a limited part of the trial, i.e. without the edges. You could then apply //​negative//​ trialpadding (using a negative value for ''​cfg.artfctdef.xxx.trlpadding''​). ​
  
-{{:​tutorial:​negative_trlpadding.svg|}}+{{:​tutorial:​negative_trlpadding.png|}}
  
 //Negative trialpadding excluded the edges of trials for artifact detection// //Negative trialpadding excluded the edges of trials for artifact detection//
Line 264: Line 264:
 {{:​tutorial:​artifactmuscle.png?​600nolink&​|}} {{:​tutorial:​artifactmuscle.png?​600nolink&​|}}
  
-//A typical muscle artifact can be observed on channel ​MRT32, trial 32.//+//A typical muscle artifact can be observed on channel ​MRT12, trial 32.//
  
 ===== Detection of EOG artifacts ===== ===== Detection of EOG artifacts =====