Source Localization error

Hi,

I have been endeavoring to compute the quantitative evaluation metrics of source localization, including Normalized Mean Squared Error (MSE), distribution discrepancy, and spatial dispersion, for both MRI volume and cortex surface of source localization.

The calculation of ImageGridAmp was conducted within the Matlab workspace (command window) using ImageGridAmp=ImagingKernel*recordings, as I encountered difficulties when attempting to utilize the Full results advanced option during the source estimation process from EEG recordings.

My inquiry pertains to identifying the appropriate pipeline within Brainstorm for conducting the evaluation metrics. Alternatively, if such functionality is not available within Brainstorm, I seek guidance on which data should be exported to Matlab for conducting this analysis.

Thank you in advance for your assistance.

Best regards,
Masuma

Currently these metrics are not implemented in Brainstorm.

We welcome contributions!
See how to contribute to Brainstorm:
https://github.com/brainstorm-tools/brainstorm3/blob/master/CONTRIBUTING.md

To compare source estimations, you could create a process that:

  1. Takes two source files (A and B)
  2. Verify that they were computed using the same source
  3. Load SourcesA, load SourcesB (this is automatically handle by the process)
  4. Compute metric, and save metric a Matrix file

As such, it has to a a process available in the Process2 tab.
You can take the process process_diff_ab.m as a starting point.
https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/process/functions/process_diff_ab.m

Relevant info on how to create a Process:
https://neuroimage.usc.edu/brainstorm/Tutorials/TutUserProcess

And info to function to read/write data from/to the Brainstorm database:
https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting#Reference:_File_manipulation

Thank you for your prompt response; I am eager to contribute to Brainstorm.

I have a question regarding the ImageGridAmp matrix, obtained from either ImageGridAmp=ImagingKernel*recordings or Full results. Is this matrix considered a source activity matrix? Initially, I intended to compute the evaluation matrix within the Matlab editor and subsequently transfer it to the Brainstorm process. Hence, it is crucial for me to determine which data file I should export from Brainstrom to the Matlab editor as a source activity matrix. To let you know, I generated ERP from EEG, Head model using cortex/volume MRI of participants, and corresponding source modeling using ERP and head model.

Your clarification on this matter would be greatly appreciated.

Best regards,
Masuma

Yes it is. For constrained sources it has the shape [nVertices, nTime]. For unconstrained sources it has the shape [3*nVertices, nTime] as there are 3 time series (x ,y and z) per vertex, the matrix is arranged as Vertex1_x, Vertex1_y, Vertex1_z, Vertex2_x ... VertexN_z

Hi,

Thank you once again for your prompt response to my previous inquiry.

I have two additional questions regarding the source modeling process:

  1. After completing the source modeling, if I make any adjustments to the pre-processing steps applied to the EEG data (such as modifying band frequencies or removing ICA components), or if there are changes in the MRI-electrode coregistration, would it be necessary to perform source re-modeling? Alternatively, would the impact of these changes in the processing pipeline be automatically updated in the source activity matrix?
  2. If I were to perform normalization of the unconstrained sources using z-transform, specifically normalizing with the scores of unconstrained sources, what would be the resulting size of the source activity matrix?

Your insights on these matters would be greatly appreciated.

Best regards, Masuma

Yes, you would need to recompute the source estimation.

  • Changing the pre-processing on the data will also change the covariance matrix, used in source estimation.
  • Changing the electrode position changes the forward model, and with it also the source estimation.

It will have the same size as the unconstrained sources [3*nVertices, nTime].
As each times series (3 per vertex) is z-scored with its mean and std