Noise and Data Covariance

Dear Francois:
If I want to process my MEG dataset first with event-related source localization, followed by a connectivity analysis, what would be the best way to do it without having to re-process the entire dataset from the beginning when I am done with the event-related source localisation? I have done all the pre-processing steps with quality control carefully following all the online tutorials and your answers for my questions (thank you for being so helpful!), and I have imported an epoch of -200ms - 800ms for all conditions and all my subjects given that my maximum ISI is 1000ms and I assume the 1000ms epoch window would be fine for both event-related and connectivity analyses (I am not going to do any time-frequency analysis). Now based on the online tutorial, I should do the head modeling step, followed by the noise covariance and data covariance steps, and then source localisation step, correct? I have only 2 conditions of interest and have epoched them separately and averaged all the trials within each condition.

When I try to use the Process1 Box to process the Head Modeling step for all my subjects at once, I should only drag the "RAW" folder of each subject and not any of the 2 conditions folders down to the Process1 Box, am I right? Or I should instead drag the 2 conditions' folders to generate the head model with? And then, from the Process1 Box's "RUN" button I find the "source" > "compute head model"
menu, and then I made the following selections: Source space=Cortex surface; Forward model=Overlapping spheres. Do these look right to you?

After this head model step, when I proceed with the noise covariance step, here should I drag the "RAW" time series or the epoched 2 conditions' time series down to the Process1 Box? On the tutorial pages, both ways are displayed and I wonder what's the difference between these 2 ways? I am interested in finding the sources of my 2 conditions of interest (the "repeat" versus the "new" condition in an n-back task). So I guess I can just drag down the 2 epoched conditions' time series (not the average series) right? This doesn't need to be consistent with the head modeling step's data input, right? (And if I use the "RAW" series here, I will have to later use the option of "copy" the noise covariance "to other folders"?) Then, from the Process 1's RUN button I find "Source" > "Compute covariance (noise or data)", and then I make the following options: For "Matrix to estimate" I click on the "Noise covariance" and in the "Process options" I fill up the "Baseline" window with: "-200 ms to -1.5 ms", but what should I fill in with the "data" window (This "data window" option is only available in the "data covariance" interactive GUI)? And then I select the "Block by block, to avoid effects of slow shifts in data". And I leave all the bottom "Output options" unchecked. And for the option of "If the file already exists" I choose "Replace". Do these look good to you?

After this, I should do the "Data Covariance" step in the same processing window by selecting "Data covariance", and leave every parameter the same as used for the Noise Covariance step except for adding the "Data" time window with "all the time available post-stimulus", right? Assuming I use the epoched time series for my 2 conditions of interest here, I should fill a time window of 0ms to 800ms right? (And if I use the raw time series here, it'll be a lot of milli-seconds to put in here..). Please correct me if I should change any of my thoughts/steps.

For this Data Covariance step, it is for the current event-related processing but for a later connectivity processing, I don't need this step of Data Covariance right? I wonder how should I deal with it so I don't need to re-process everything from the beginning?

After the above steps are all done, I can go ahead to proceed with source localization step, right? :slight_smile:

Thank you so much again Francoise!

Yuwen

Now based on the online tutorial, I should do the head modeling step, followed by the noise covariance and data covariance steps, and then source localisation step, correct?

Data covariance is only needed for the LCMV beamformer, which is not the approach we try to promote in Brainstorm. We don't have much experience with this approach and can't give clear directions on how to select the time segments for computing this data covariance.

When I try to use the Process1 Box to process the Head Modeling step for all my subjects at once, I should only drag the "RAW" folder of each subject and not any of the 2 conditions folders down to the Process1 Box, am I right? Or I should instead drag the 2 conditions' folders to generate the head model with?

It depends how your database is organized. You should select at least one file in each of the folders in which you want a headmodel to be computed. Having two folders for two separate conditions might require to compute twice exactly the same forward model. If this is long (eg. OpenMEEG BEM), you may compute it only once and copy paste it to the other folders.

And then, from the Process1 Box's "RUN" button I find the "source" > "compute head model"
menu, and then I made the following selections: Source space=Cortex surface; Forward model=Overlapping spheres. Do these look right to you?

It depends on what you want to compute. Select the same options as what you would do from the interactive interface. If you haven't done it, I'd recommend you start by processing at least one of your subjects with the GUI before trying to script the analysis for all the subjects at once.

After this head model step, when I proceed with the noise covariance step, here should I drag the "RAW" time series or the epoched 2 conditions' time series down to the Process1 Box? On the tutorial pages, both ways are displayed and I wonder what's the difference between these 2 ways?

It depends what you consider as being a baseline brain activity in your experiment. The various options we offer are described here:
https://neuroimage.usc.edu/brainstorm/Tutorials/NoiseCovariance#Variations_on_how_to_estimate_sample_noise_covariance
In all cases, avoid computing this noise covariance matrix from averaged responses (this is not part of the suggestions in this tutorial).

from the Process 1's RUN button I find "Source" > "Compute covariance (noise or data)", and then I make the following options: For "Matrix to estimate" I click on the "Noise covariance" and in the "Process options" I fill up the "Baseline" window with: "-200 ms to -1.5 ms", but what should I fill in with the "data" window (This "data window" option is only available in the "data covariance" interactive GUI)?

The "data" parameter is ignored for the computation of the noise covariance matrix.
Again, start by prototyping your analysis with the interactive approach rather than the process/batch version, it will guide you much more for defining all the parameters of your analysis. Most of the options that are available in the process options but that are not asked in the interactive processing are not used in the context your analysis. The pipeline editor window offers all the possible options for the functions that are called, even if they are not relevant in the specific case of your dataset, this makes it more confusing if you don't know exactly what you want to do.

Dear Francois:
Thank you so much for the most helpful information!

Yuwen

Dear Francois:
I epoched the data for -200 ms to 800 ms for both event-related an connectivity analyses (not time-frequency analysis). For now I am just focusing the event-related analysis and I wonder for the current Noise Covariance step, is it OK to use only -100 ms to 0 ms as the baseline noise window instead of using the whole -200 ms to 0 ms window that I have epoched? (Would this be criticized as not consistent with the time window that I have epoched I wonder?) The thought for this is that I think -100ms to 0 ms would be "cleaner" than -200 ms to 0 ms for my current event-related analysis (and to increase the signal to noise ratio in terms of finding significant post-stimulus event-related sources). It'd be great to know what you think!

Thank you -
Yuwen

It is OK to use a shorter time segment for the computation of the noise covariance matrix. You don't need to use the full baseline your imported in your epochs.

However, you have to be aware that the more data you have, the more stable the computation of the covariance. If you have a lot of trials, you can probably shorten the duration of the time window you use in each trial to evaluate the noise covariance. If you make it too short, the noise covariance may become noisier and degrade the quality of the source estimation.
You need to find a good balance between the quality of the noise covariance estimation, and the consistency of your analysis pipeline with respect to your neuroscience hypothesis.

Thanks for the information and thought, Francois!

Yuwen