diff --git a/assets/img/tutorial/automatic_artifact_rejection/overview_artifact_detection.png b/assets/img/tutorial/automatic_artifact_rejection/figure1.png similarity index 100% rename from assets/img/tutorial/automatic_artifact_rejection/overview_artifact_detection.png rename to assets/img/tutorial/automatic_artifact_rejection/figure1.png diff --git a/assets/img/tutorial/automatic_artifact_rejection/bothpadding.png b/assets/img/tutorial/automatic_artifact_rejection/figure10.png similarity index 100% rename from assets/img/tutorial/automatic_artifact_rejection/bothpadding.png rename to assets/img/tutorial/automatic_artifact_rejection/figure10.png diff --git a/assets/img/tutorial/automatic_artifact_rejection/negative_trlpadding.png b/assets/img/tutorial/automatic_artifact_rejection/figure11.png similarity index 100% rename from assets/img/tutorial/automatic_artifact_rejection/negative_trlpadding.png rename to assets/img/tutorial/automatic_artifact_rejection/figure11.png diff --git a/assets/img/tutorial/automatic_artifact_rejection/artifactjump.png b/assets/img/tutorial/automatic_artifact_rejection/figure12.png similarity index 100% rename from assets/img/tutorial/automatic_artifact_rejection/artifactjump.png rename to assets/img/tutorial/automatic_artifact_rejection/figure12.png diff --git a/assets/img/tutorial/automatic_artifact_rejection/artifactjump2.png b/assets/img/tutorial/automatic_artifact_rejection/figure13.png similarity index 100% rename from assets/img/tutorial/automatic_artifact_rejection/artifactjump2.png rename to assets/img/tutorial/automatic_artifact_rejection/figure13.png diff --git a/assets/img/tutorial/automatic_artifact_rejection/artifactmuscle.png b/assets/img/tutorial/automatic_artifact_rejection/figure14.png similarity index 100% rename from assets/img/tutorial/automatic_artifact_rejection/artifactmuscle.png rename to assets/img/tutorial/automatic_artifact_rejection/figure14.png diff --git a/assets/img/tutorial/automatic_artifact_rejection/artifacteog.png b/assets/img/tutorial/automatic_artifact_rejection/figure15.png similarity index 100% rename from assets/img/tutorial/automatic_artifact_rejection/artifacteog.png rename to assets/img/tutorial/automatic_artifact_rejection/figure15.png diff --git a/assets/img/tutorial/automatic_artifact_rejection/eq1.png b/assets/img/tutorial/automatic_artifact_rejection/figure2.png similarity index 100% rename from assets/img/tutorial/automatic_artifact_rejection/eq1.png rename to assets/img/tutorial/automatic_artifact_rejection/figure2.png diff --git a/assets/img/tutorial/automatic_artifact_rejection/eq2.png b/assets/img/tutorial/automatic_artifact_rejection/figure3.png similarity index 100% rename from assets/img/tutorial/automatic_artifact_rejection/eq2.png rename to assets/img/tutorial/automatic_artifact_rejection/figure3.png diff --git a/assets/img/tutorial/automatic_artifact_rejection/eq3.png b/assets/img/tutorial/automatic_artifact_rejection/figure4.png similarity index 100% rename from assets/img/tutorial/automatic_artifact_rejection/eq3.png rename to assets/img/tutorial/automatic_artifact_rejection/figure4.png diff --git a/assets/img/tutorial/automatic_artifact_rejection/eq4.png b/assets/img/tutorial/automatic_artifact_rejection/figure5.png similarity index 100% rename from assets/img/tutorial/automatic_artifact_rejection/eq4.png rename to assets/img/tutorial/automatic_artifact_rejection/figure5.png diff --git a/assets/img/tutorial/automatic_artifact_rejection/zthreshold.png b/assets/img/tutorial/automatic_artifact_rejection/figure6.png similarity index 100% rename from assets/img/tutorial/automatic_artifact_rejection/zthreshold.png rename to assets/img/tutorial/automatic_artifact_rejection/figure6.png diff --git a/assets/img/tutorial/automatic_artifact_rejection/artpadding.png b/assets/img/tutorial/automatic_artifact_rejection/figure7.png similarity index 100% rename from assets/img/tutorial/automatic_artifact_rejection/artpadding.png rename to assets/img/tutorial/automatic_artifact_rejection/figure7.png diff --git a/assets/img/tutorial/automatic_artifact_rejection/trlpadding.png b/assets/img/tutorial/automatic_artifact_rejection/figure8.png similarity index 100% rename from assets/img/tutorial/automatic_artifact_rejection/trlpadding.png rename to assets/img/tutorial/automatic_artifact_rejection/figure8.png diff --git a/assets/img/tutorial/automatic_artifact_rejection/fltpadding.png b/assets/img/tutorial/automatic_artifact_rejection/figure9.png similarity index 100% rename from assets/img/tutorial/automatic_artifact_rejection/fltpadding.png rename to assets/img/tutorial/automatic_artifact_rejection/figure9.png diff --git a/tutorial/automatic_artifact_rejection.md b/tutorial/automatic_artifact_rejection.md index 28c978a0a..0e8501c13 100644 --- a/tutorial/automatic_artifact_rejection.md +++ b/tutorial/automatic_artifact_rejection.md @@ -34,7 +34,7 @@ The following steps are used to detect artifacts in FieldTrip's automatic artifa 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 [ft_rejectartifact](/reference/ft_rejectartifact). All the steps that the automatic artifact rejection routine takes will now be explained in detail. -{% include image src="/assets/img/tutorial/automatic_artifact_rejection/overview_artifact_detection.png" width="600" %} +{% include image src="/assets/img/tutorial/automatic_artifact_rejection/figure1.png" width="600" %} _Figure: 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 @@ -63,12 +63,12 @@ The automatic artifact detection approach used here is based on three characteri _This results in one timecourse representing standardized deviations from the mean of all channels._ The formulas for calculating the z-scores are: -{% include image src="/assets/img/tutorial/automatic_artifact_rejection/eq1.png" width="120" %} +{% include image src="/assets/img/tutorial/automatic_artifact_rejection/figure2.png" width="120" %} where -{% include image src="/assets/img/tutorial/automatic_artifact_rejection/eq2.png" width="120" %} -{% include image src="/assets/img/tutorial/automatic_artifact_rejection/eq3.png" width="150" %} +{% include image src="/assets/img/tutorial/automatic_artifact_rejection/figure3.png" width="120" %} +{% include image src="/assets/img/tutorial/automatic_artifact_rejection/figure4.png" width="150" %} with: N = the total number of time samples. @@ -76,7 +76,7 @@ In the code this formula is formed such as to optimize the calculation of the ch The summation is performed in the following way: -{% include image src="/assets/img/tutorial/automatic_artifact_rejection/eq4.png" width="120" %} +{% include image src="/assets/img/tutorial/automatic_artifact_rejection/figure5.png" width="120" %} with: C = the number of channels. @@ -85,7 +85,7 @@ with: C = the number of channels. Now that every timepoint is expressed as a deviation for the mean over time & channels, we can use an artifact detection threshold: all timepoints that are above or below this threshold (set ''with cfg.artfctdef.zvalue.cutoff'') will be considered belonging to artifacts. Depending on the variance of the artifacts versus the variance of your brain signal a higher or lower threshold has to be set. The lower this threshold the more conservative the artifact detection will behave, the higher the more liberal (see figure). Since these characteristics of the data might vary per experiment and even from one recording to another, care has to be taken to investigate the threshold that works for you. By using the option ''cfg.feedback='yes''', you enter an interactive mode where you can browse through the data and adjust the cut-off value (i.e., the z-value used for thresholding) according to your data and filter settings. -{% include image src="/assets/img/tutorial/automatic_artifact_rejection/zthreshold.png" %} +{% include image src="/assets/img/tutorial/automatic_artifact_rejection/figure6.png" %} _Figure: Setting a higher or lower z-value threshold will make the detection of artifacts more conservative or liberal_ @@ -95,7 +95,7 @@ _Figure: Setting a higher or lower z-value threshold will make the detection of When a series of continuous time points are detected they are considered part of one artifact period and enter the artifact definition as one start and end sample number. 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. -{% include image src="/assets/img/tutorial/automatic_artifact_rejection/artpadding.png" %} +{% include image src="/assets/img/tutorial/automatic_artifact_rejection/figure7.png" %} _Artifact padding extends the segment of data that will be marked as artifact._ @@ -103,7 +103,7 @@ _Artifact padding extends the segment of data that will be marked as artifact._ 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. -{% include image src="/assets/img/tutorial/automatic_artifact_rejection/trlpadding.png" width="600" %} +{% include image src="/assets/img/tutorial/automatic_artifact_rejection/figure8.png" width="600" %} _Trialpadding extends the period around the trial where artifact detection is performed_ @@ -112,21 +112,21 @@ _Trialpadding extends the period around the trial where artifact detection is pe Each artifact type can best be detected with filters of a certain pass band (e.g., pass band of 1–15 Hz for eye blinks, and 110–140 Hz for muscle artifacts). However, filters are known to produce edge effects which can also be detected by the artifact-detection routine and mistaken for real artifacts. 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). -{% include image src="/assets/img/tutorial/automatic_artifact_rejection/fltpadding.png" width="600" %} +{% include image src="/assets/img/tutorial/automatic_artifact_rejection/figure9.png" width="600" %} _Figure: Filter padding. Filter padding is only used during filtering and removed afterwards_ ### Combining filter and trial padding 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). -{% include image src="/assets/img/tutorial/automatic_artifact_rejection/bothpadding.png" %} +{% include image src="/assets/img/tutorial/automatic_artifact_rejection/figure10.png" %} _Figure: Filter and trial padding_ ### Negative trialpadding 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''). -{% include image src="/assets/img/tutorial/automatic_artifact_rejection/negative_trlpadding.png" %} +{% include image src="/assets/img/tutorial/automatic_artifact_rejection/figure11.png" %} _Negative trialpadding excluded the edges of trials for artifact detection_ @@ -195,7 +195,7 @@ such as the one below, which provides you information with respect to the detection procedure and gives you the ability to try out different z-value cutoff values. -{% include image src="/assets/img/tutorial/automatic_artifact_rejection/artifactjump.png" width="600" %} +{% include image src="/assets/img/tutorial/automatic_artifact_rejection/figure12.png" width="600" %} _Interactive figure of ft_artifact_zvalue. The left panel shows the z-score of the processed data, along with the threshold. Suprathreshold @@ -210,7 +210,7 @@ In this example data set, a lot of data points are detected to be a 'jump' artifact, although they seem more often 'muscular' in nature. A typical jump artifact can be seen below: -{% include image src="/assets/img/tutorial/automatic_artifact_rejection/artifactjump2.png" width="600" %} +{% include image src="/assets/img/tutorial/automatic_artifact_rejection/figure13.png" width="600" %} _A typical SQUID jump can be observed on channel MLT42, trial 18._ @@ -251,7 +251,7 @@ The same way as **[ft_artifact_zvalue](/reference/ft_artifact_zvalue)** is used [cfg, artifact_muscle] = ft_artifact_zvalue(cfg); -{% include image src="/assets/img/tutorial/automatic_artifact_rejection/artifactmuscle.png" width="600" %} +{% include image src="/assets/img/tutorial/automatic_artifact_rejection/figure14.png" width="600" %} _A typical muscle artifact can be observed on channel MRT12, trial 32._ @@ -286,7 +286,7 @@ Note that only the EOG is scanned in the eye artifacts case, which will take les [cfg, artifact_EOG] = ft_artifact_zvalue(cfg); -{% include image src="/assets/img/tutorial/automatic_artifact_rejection/artifacteog.png" width="600" %} +{% include image src="/assets/img/tutorial/automatic_artifact_rejection/figure15.png" width="600" %} _Typical eyeblink artifacts can be observed in trial 4. Note that the trial considers artifacts to precede and last longer than the threshold crossing, by padding data with 0.1 seconds on the left and 0.1 sec on the right_