Generate the fMRI-like data using EEG source estimation result

Dear all,

General setting

  • I would like to generate the fMRI-like data using EEG source estimation result from a concurrent EEG-fMRI study. Specifically, we collected the resting-state EEG and fMRI simultaneously. Suppose, the size of EEG is Nchannel X Ntime (where Nchannel is the number of EEG electrodes and Ntime=Nvolume*1000 where Nvolume is the number of the volume for fMRI). During each volume, 1000 EEG data points were collected for each channel.
    Suppose, I have finished necessary preprocessing procedures and using the Minimum norm imaging (with constraint: Normal to cortex) method and Nsource vertices (or solution points) was selected. fMRI was normalized to MNI template space with the size equal to Nlength X Nwidth X Nheight X Nvolume. So the ultimate goal is to use EEG source estimation result to generate fMRI-like data with the size equal to Nlength X Nwidth X Nheight X Nvolume. I have two possible strategies and also some questions about the implementation.

1st strategy:

Steps:

Because it seems impossible to extract the whole source time series (Nsource X Ntime, memory-consuming) directly, I'd like to process data block by block.
(1) Split the continuous EEG into Nvolume blocks. Then process each block and I will take one block as an example.
(2) Using 'Export to SPM12' function to get source signal of one block and then for each solution point, one value will be calculated based on the time series then get new block source data(the length of time dimension is reduced to 1 now).
(3) Finally, concatenate all processed blocks.

Questions:

<1> When I use 'export to SPM12 (surface)' function, I found a compulsory option called 'Average over time window', but in this case, I just want to get the whole time series which means I don't want to average values across time. So what should I do?
<2> I am not sure the exported source signal was in subject individual MRI sapce or MNI template space. If it's in individual space, how can I convert to MNI space? what function I can use?

2nd strategy:

Steps:

In this strategy, I would like to use the inverse solution transformation matrix (a.k.a. ImagingKernal with the size equal to Nsource X Nchannel) to transform the electrode-level signal to the source-level signal. Due to memory reasons, I'd still choose to process data block by block.
(1) Split the continuous EEG into Nvolume blocks. Then process each block and I will still take one block as an example.
(2) The size of each block EEG (EEG_electrode) is Nchannel X Ntime. The output block source (EEG_source) can be obtained by ImagingKernal*EEG_electrode .
(3) Convert EEG_source (Nsource X Ntime) to volumetric data (Nlength X Nwidth X Nheight X Ntime) in MNI template space. ( ```
!Although I don't know how to conduct this step.)
(4) For each solution point, one value will be calculated based on the time series then get new block source data(the length of time dimension is reduced to 1 now).
(5) Finally, concatenate all processed blocks.

Questions:

<1> The similar concern that the so-called transformation matrix ImagingKernal transform signal to individual space or MNI template space?
<2> As mentioned in step (3), how to convert a 2-D matrix to a 4-D volumetric data? Which function I can use? I mean there should be a mapping relationship between the elements in these two matrics. In another word, there should be a corresponding MNI coordinate for each row of EEG_source to indicate the position in MNI template. How can I convert it conveniently?

Also, the whole processing could be tedious and labor-heavy if I use BST GUI. So I prefer to use script to finish most of the work if possible and wonder if it is feasible.

Looking forward to your kind reply and thanks in advance.

Best Regards,
CC

1 Like

When I use 'export to SPM12 (surface)' function, I found a compulsory option called 'Average over time window', but in this case, I just want to get the whole time series which means I don't want to average values across time. So what should I do?

You can't save time in the surface .gii files. This file format is not mean for that.
You can do it with .nii volumes, but the output would be just gigantic.
Why do you need this .gii output?

I am not sure the exported source signal was in subject individual MRI sapce or MNI template space . If it's in individual space, how can I convert to MNI space? what function I can use?

If your source maps are computed on the individual subject anatomy, the output is in subject space.
To get it in MNI space, first project your source maps on a template:
https://neuroimage.usc.edu/brainstorm/Tutorials/CoregisterSubjects

Convert EEG_source ( Nsource X Ntime ) to volumetric data

If what you want to process are volume source maps, maybe you should use a volume source space... It would produce much smoother and meaningful volume maps that the reinterpolation surface > volume.
https://neuroimage.usc.edu/brainstorm/Tutorials/TutVolSource

The similar concern that the so-called transformation matrix ImagingKernal transform signal to individual space or MNI template space ?

The projection between surfaces (including from subject to MNI template) is handled by the function bst_project_sources.m. Check out the code directly if you want help with it.
brainstorm3/toolbox/math/bst_project_sources.m at master · brainstorm-tools/brainstorm3 · GitHub

how to convert a 2-D matrix to a 4-D volumetric data?

The interpolation matrix from a surface to a volume is computed by function tess_interp_mri.m
brainstorm3/toolbox/anatomy/tess_interp_mri.m at master · brainstorm-tools/brainstorm3 · GitHub
Look for example of calls in the brainstorm3 folder.

Also, the whole processing could be tedious and labor-heavy if I use BST GUI. So I prefer to use script to finish most of the work if possible and wonder if it is feasible.

Everything can be scripted.
Are they things you don't manage to reproduce in a script?