The forward solution gives me an unplausible gain matrix.

**Visualizing lead field yields constant frontal contribution - reference problem? **

  • MNE version: 1.11.0
  • operating system: macOS 15

Hi everyone,

thank you for taking the time for my question.

In my project, I generate synthetic source-level data and want to project it on EEG and MEG sensors. I am therefore calculating the forward solution, so I can multiply at the end the synthetic signal at source level with the gain matrix to acquire sensor-level synthetic data. I describe my workflow and problem below:

I do use open-source data available here A multi-subject, multi-modal human neuroimaging dataset ( A multi-subject, multi-modal human neuroimaging dataset | Scientific Data )

Those are the steps I apply:

1. I run the Freesurfers recon-all pipeline

  • I then used Blender to make slight adjustments to inner_skull to avoid overlaps.

2. I then calculate the BEM:

mne.bem.make_watershed_bem(sub, sub_dir, volume='T1') 
mne.bem.make_scalp_surfaces(sub, sub_dir, no_decimate=True)
mne.viz.plot_bem(**plot_bem_kwargs)
src = mne.setup_source_space(subject, spacing="all", add_dist="patch", subjects_dir=subjects_dir)

3. I preprocess the MEEG

real_data = mne.io.read_raw_fif(data_path)
real_data.load_data()
# SPECIFIC TO THIS DATASET WE NEED TO MAKE SOME CORRECTIONS 
# from Wakeman (2015) "(due to a problem with the acquisition software, these three channels are not properly labelled in the fif files: EEG061 = HEOG; EEG062 = VEOG; EEG063 = ECG)"
real_data.set_channel_types(mapping = {'EEG061': 'eog','EEG062': 'eog','EEG063': 'ecg'})
real_data.rename_channels(mapping = {'EEG061': 'HEOG','EEG062': 'VEOG','EEG063': 'ECG'})
real_data.filter(l_freq = 1, h_freq=35)

I then perform ICA and select the ecg and eog components after I apply ICA, I call my data

# then I set do set average reference
cleaned_data.set_eeg_reference(ref_channels='average', projection=True, ch_type='eeg')  

4.I then do the co-registration

mne.gui.coregistration(inst=cleaned_data_path, subject=sub,subjects_dir=sub_dir,head_high_res=True,interaction='terrain')

5. I then calculate the forward solution:

# load subject source space
src = mne.setup_source_space(sub, spacing="all", add_dist="patch", subjects_dir=sub_dir, verbose = False)
# set up BEM
conductivity = (0.3, 0.006, 0.3)
model = mne.make_bem_model(subject=sub, ico=4, conductivity=conductivity,  subjects_dir=sub_dir)
bem = mne.make_bem_solution(model)
    
  # load Modality INFO
real_data = mne.io.read_raw_fif(cleaned_data_path)
info = real_data.info 

fwd = mne.make_forward_solution(
        info,
        trans=trans, # from GUI above
        src=src,
        bem=bem,
        meg=True,
        eeg=True,
        mindist=5.0,
    )

6. I then visualize the forward solution lead field:

fwd = mne.convert_forward_solution(fwd, force_fixed=True, use_cps = True) 
EEGs_loc = np.where(np.char.find(np.array(all_data.info['ch_names']), 'EEG') == 0)[0]
gain_EEG = fwd["sol"]["data"][EEGs_loc]
plt.imshow(gain_EEG, aspect ='auto')

Now the problem:

I now want to visualize the contribution of all sources to a single sensor (figure below, left).

sensor_name = 'EEG051'

# chose single sensor from forward solution
fwd_eeg = fwd.copy().pick_channels([sensor_name])
gain = fwd_eeg["sol"]["data"].flatten()

visualized below is the gain for one EEG channel projected on the source surface. The selected EEG channel is plotted in red.

plotting the summed gain for all sensors (figure below, right) reveals a similar pattern, where the front has a strong negative influence on all channels. (Figure visualizes max-normalized sum of gain)
This effect is not observed for MEG.

sum_gain = np.sum(fwd["sol"]["data"][EEGs_loc], axis = 0)

brain = Brain(subject = sub, hemi="both", surf="pial", subjects_dir=data_dir, size=(800, 600))
brain.add_data(sum_gain[:n_left]/sum_gain.max(), hemi="lh", vertices=def_vertices_lh, colormap = 'rainbow',fmin = -1, fmax = 1)
brain.add_data(sum_gain[-n_right:]/sum_gain.max(), hemi="rh", vertices=def_vertices_rh, colormap = 'rainbow',fmin = -1, fmax = 1)
brain.add_sensors(nosensor_data.info, trans, sensor_colors = 'grey')
brain.add_sensors(sensor_data.info, trans, sensor_colors = 'red')

Question and speculations:

Why does the frontal region negatively contribute to all EEG sensors, regardless of their position? This problem is not specific to this channel but a general phenomena pronounced over all EEG channels.

What I have tried before to solve the problem:

  • different parameters for bem and src and forward model (problem remains)
  • visualized dipoles and direction (all looks fine)
  • Using the pipeline on a different subject of the same dataset yields the same problem
  • Using the pipeline on a different dataset ** does not ** yield the same problem

I therefore think it might be due to the data I use:

  • could it be due to the reference of the original data? "The EEG reference electrode was placed on the nose, and the common ground electrode was placed at the left collar bone."Wakeman (2015) I did re-reference the data, but the problem remains.
  • What else could create a gain matrix like this one?
  • If I continue projecting my source activity to (M)EEG, there will be a huge bias towards the frontal regions. Is there anything I can do to fix that?

Thank you for your help. I hope the explication was clear.

it’s not a negative influence, it’s just that the current is flowing away from the sensors hence producing a negative voltage. If the orientation of the source was flipped, it would be a positive voltage.