Skip to content

Commit

Permalink
OPM tutorial for CuttingEEG X (4) (#817)
Browse files Browse the repository at this point in the history
* fixed figures

* fixed internal links

* Update squids_vs_opms.md

* removed files

* fixed figures

---------

Co-authored-by: Jan-Mathijs Schoffelen <1517611+schoffelen@users.noreply.github.com>
  • Loading branch information
contsili and schoffelen authored Oct 30, 2024
1 parent c69793b commit 8269d0d
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 3,428 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
708 changes: 0 additions & 708 deletions assets/img/workshop/cuttingeegx/scan_face.eps

This file was deleted.

Binary file added assets/img/workshop/cuttingeegx/scan_face.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,402 changes: 0 additions & 1,402 deletions assets/img/workshop/cuttingeegx/scan_head.eps

This file was deleted.

Binary file added assets/img/workshop/cuttingeegx/scan_head.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,307 changes: 0 additions & 1,307 deletions assets/img/workshop/cuttingeegx/scan_helmet.eps

This file was deleted.

Binary file added assets/img/workshop/cuttingeegx/scan_helmet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 14 additions & 11 deletions workshop/cuttingeegx/squids_vs_opms.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ OPMs are flexible in their placement allowing for new recording strategies. Thes

OPMs are magnetometers, as their name suggests. Magnetometers are more sensitive to environmental noise than gradiometers, which most SQUID systems have. Several data analysis algorithms to remove environmental noise have been proposed (see [Seymour et al (2022)](https://www.sciencedirect.com/science/article/pii/S1053811921011058?via%3Dihub) for more details). In this tutorial, we apply homogeneous field correction (HFC). HFC works better with a large number of sensors.


Unlike SQUID systems, which have standard coregistration strategies, OPMs don't have a single coregistration standard. In this tutorial, we coregister the OPMs with the MRI using an optical 3D scanner which captures the participant’s facial features along with the OPM helmet ([Zetter et al., 2019](https://www.nature.com/articles/s41598-019-41763-4)).

This tutorial combines the FieldTrip tutorials on [preprocessing of Optically Pumped Magnetometer (OPM) data](tutorial/preprocessing_opm/) and [coregistration of Optically Pumped Magnetometer (OPM) data](tutorial/coregistration_opm/). It does not cover follow-up analyses (like source reconstruction) which in principle should not differ from the SQUID follow-up analyses, or alternative coregistration methods which are covered in the tutorial on [coregistration of Optically Pumped Magnetometer (OPM) data](tutorial/coregistration_opm/).
Expand Down Expand Up @@ -68,7 +69,7 @@ For the OPMs we will take the following steps:
### SQUID


We begin by loading the SQUID data and defining trials. In the experiment, the inter-trial interval ranged from 800-1200 ms. We select a 200 ms prestimulus and 400 ms poststimulus window. We then select trials where left median nerve stimulation occurred (trigger code = 1).
We begin by loading the SQUID data and defining trials. We select trials in which left median nerve stimulation occurred (trigger code = 1). In the experiment, the inter-trial interval ranged from 800-1200 ms, so it makes sense to select a 200 ms prestimulus and 400 ms poststimulus window.

```
%% Preprocessing & trial definition
Expand All @@ -81,7 +82,7 @@ cfg.trialdef.prestim = 0.2;
cfg.trialdef.poststim = 0.4;
cfg = ft_definetrial(cfg);
cfg.demean = 'yes';
cfg.demean = 'yes'; % apply baseline correction
cfg.baselinewindow = [-Inf 0];
cfg.channel = 'MEG';
cfg.continuous = 'yes';
Expand All @@ -95,7 +96,7 @@ The summary method in **[ft_rejectvisual](/reference/ft_rejectvisual)** allows t
```
%% Removing artifacts manually
load data_stim data_stim
load data_squid data_squid
cfg = [];
cfg.method = 'summary';
Expand All @@ -104,7 +105,7 @@ data_squid_clean = ft_rejectvisual(cfg, data_squid);
save data_squid_clean data_squid_clean
```

We start by removing trials that have higher variance than 8e-25 Tesla-squared, then assess the channels. Removing trials also reduces channel variance, so no need to reject any channels.
We start by removing trials that have higher variance (bottom-left plot). Based on our data, a reasonable threshold to choose is 8e-25 Tesla-squared. Next, we assess the channel variance (top-right plot). Removing trials with high variance resulted in reducing the channel variance too, so no need to reject any channels.

{% include image src="/assets/img/workshop/cuttingeegx/cuttingeegx_ft_rejectvisual.png" width="500" %}

Expand Down Expand Up @@ -170,7 +171,7 @@ f = struct2cell(f);
cfg.trialdef.poststim = 0.4;
cfg = ft_definetrial(cfg);
cfg.demean = 'yes';
cfg.demean = 'yes'; % apply baseline correction
cfg.baselinewindow = [-Inf 0];
cfg.channel = {'all', '-ai61'};
data_opm(i) = ft_preprocessing(cfg);
Expand All @@ -180,7 +181,7 @@ f = struct2cell(f);
save data_opm data_opm
```

OPM are magnetometers which are more sensitive to the environmental noise than the SQUID gradiometers. To remove some of the environmental noise, we can apply a denoising technique called homogeneous field correction (HFC) to clean the data.
OPM are magnetometers which are more sensitive to the environmental noise than the SQUID gradiometers. To remove some of the environmental noise, several algorithmic denoising techniques have been proposed ([Seymour et al., 2022](https://www.sciencedirect.com/science/article/pii/S1053811921011058)). In this tutorial we will apply homogeneous field correction (HFC) ([Tierney et al., 2021](https://www.sciencedirect.com/science/article/pii/S1053811921007576)).

```
%% HFC
Expand All @@ -199,10 +200,6 @@ save data_opm_hfc data_opm_hfc

We will now manually remove trials with high variance.

{% include markup/skyblue %}
For the SQUID-based recordings, we removed trials with variance above the threshold of 8e-25 Tesla-squared. Is it possible to use the same threshold for the OPMs? If not, why and does this affect the quality of the OPM signal? Remember that (i) OPMs are magnetometers, and (ii) they are placed closer to the scalp than the SQUIDs.
{% include markup/end %}

```
%% Removing artifacts manually
Expand All @@ -217,6 +214,10 @@ end
save data_opm_hfc_clean data_opm_hfc_clean
```

{% include markup/skyblue %}
For the SQUID-based recordings, we removed trials with variance above the threshold of 8e-25 Tesla-squared. Is it possible to use the same threshold for the OPMs? If not, why and does this affect the quality of the OPM signal? Remember that (i) OPMs are magnetometers, and (ii) they are placed closer to the scalp than the SQUIDs.
{% include markup/end %}

```
%% Computing ERFs
Expand Down Expand Up @@ -378,9 +379,11 @@ save shape shape
```

{% include markup/skyblue %}
To understand coregistration, you first need to know what [coordinate systems](/faq/coordsys.md) are. Coregistration is about aligning data that is initially expressed in different coordinate systems into a single coordinate system.

To understand coregistration, you first need to know what [coordinate systems](/faq/coordsys) are. Coregistration is about aligning data that is initially expressed in different coordinate systems into a single coordinate system.

Start by plotting the MRI, SQUID sensors, and Polhemus headshape to see in which coordinate systems these are expressed. You can use **[ft_determine_coordsys](/utilities/ft_determine_coordsys)** for that.

{% include markup/end %}

We co-register the MRI to the SQUIDs by converting the MRI coordinate system to match that of the SQUIDs. In other words, we ensure that the three fiducials (Nasion, LPA and RPA) defined in the MRI coordinate system become aligned to the same three fiducials defined in the SQUID coordinate system.
Expand Down

0 comments on commit 8269d0d

Please sign in to comment.