From 82993ecd2a8cd4b5e3890214b22815e695aff2e8 Mon Sep 17 00:00:00 2001 From: Konstantinos Tsilimparis <105793148+contsili@users.noreply.github.com> Date: Thu, 31 Oct 2024 06:53:17 +0100 Subject: [PATCH] OPM tutorial for CuttingEEG X (5) (#818) * 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> --- workshop/cuttingeegx/squids_vs_opms.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/workshop/cuttingeegx/squids_vs_opms.md b/workshop/cuttingeegx/squids_vs_opms.md index a39e9f55..b06ae97e 100644 --- a/workshop/cuttingeegx/squids_vs_opms.md +++ b/workshop/cuttingeegx/squids_vs_opms.md @@ -456,14 +456,23 @@ 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; @@ -471,7 +480,7 @@ ft_plot_mesh(mesh_scalp, 'facealpha', 0.5, 'facecolor', 'skin', 'edgecolor', 'no 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]) @@ -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'; @@ -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});