Skip to content

Commit

Permalink
OPM tutorial for CuttingEEG X (5) (#818)
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

* Update squids_vs_opms.md

* Update squids_vs_opms.md

---------

Co-authored-by: Jan-Mathijs Schoffelen <1517611+schoffelen@users.noreply.github.com>
  • Loading branch information
contsili and schoffelen authored Oct 31, 2024
1 parent 8269d0d commit 82993ec
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions workshop/cuttingeegx/squids_vs_opms.md
Original file line number Diff line number Diff line change
Expand Up @@ -456,22 +456,31 @@ Now, we'll plot the 3D sensor topography for the time window [0.035, 0.050] seco
```
%% Plotting the 3D sensor topography
load mesh_brain mesh_brain
load mesh_scalp mesh_scalp
load avg_squid avg_squid
load ctf275 ctf275
% do not select the reference sensors
index = startsWith(ctf275.label,'M');
pos275 = ctf275.chanpos(index,:);
% average the activity of interest in the time window [0.035 0.050] sec
sampling_rate = 1200; % in Hz
prestim = 0.2;
I1 = (prestim+0.035)*sampling_rate;
I2 = (prestim+0.050)*sampling_rate;
I1 = (prestim + 0.035) * sampling_rate;
I2 = (prestim + 0.050) * sampling_rate;
selected_avg = mean(avg_stim.avg(:, I1:I2), 2);
selected_avg = mean(avg_squid.avg(:, I1:I2), 2);
% Plot
figure;
ft_plot_mesh(mesh_scalp, 'facealpha', 0.5, 'facecolor', 'skin', 'edgecolor', 'none', 'edgecolor', 'skin' )
hold on
ft_plot_mesh(mesh_brain, 'facecolor', 'brain', 'edgecolor', 'none');
hold on
ft_plot_topo3d(pos275,selected_avg, 'facealpha', 0.9)
ft_plot_topo3d(pos275, selected_avg, 'facealpha', 0.9)
camlight
view([360 0])
Expand Down Expand Up @@ -569,6 +578,7 @@ Next, we isolate the helmet region from the 3D scan using a bounding box. We wil

```
%% Isolate helmet
cfg = [];
cfg.method = 'box';
cfg.selection = 'outside';
Expand Down Expand Up @@ -666,11 +676,10 @@ transform_helmet2face = transform_scan2face/transform_scan2helmet;
The transformation matrix ```'transform_helmet2face'``` can now be used to coregister the the OPM sensors with the MRI, which aligns the OPM sensors with head-based coordinate system. Before applying the transformation, we need to read the OPM sensors from the six fif files and combine them into a single sensor file. In the FieldLine system the OPM sensors slide into the smart helmet; the fif file contains the actual position of the sensors relative to the helmet.

```
%% Read the sensors
%% Read and combine the sensors from the six recordings
f = dir('*.fif'); % add the whole path to your .fif files
f = struct2cell(f);
sens = struct();
for i=1:6
sensfile = fullfile(f{2,i},f{1,i});
Expand Down

0 comments on commit 82993ec

Please sign in to comment.