I would like to know if there is a way to see the mean cortical activation in parcellated brain regions using an stc object. To clarify, I have an stc object (fsaverage) that contains the data for some dSPM group analysis. When I apply parcellation, I can only see the cortical activation across time with the parcellation overlay on top of the source space estimate plot. I would like to know if it is possible to see which region(s) of the parcellated map (e.g. inferior frontal gyrus) will have a higher mean cortical engagement (activation) with respect to other regions.
For example, I would like to generate something like the image below. In this hypothetical image, the parcellated regions that have a higher mean of cortical activation across time (e.g. after 1000 ms) are shown in orange. I would like to know if MNE has a way of generating such parcellated plots using an stc object.
mne.SourceEstimate.extract_label_time_course gives the activation in a label (or list of labels) (aggreated across vertices but not across times; different aggregation options supported, e.g., mean, max, etc)
mne.SourceEstimate.mean averages over times but not vertices
mne.stc_to_label converts a SourceEstimate into a label, using just the non-zero vertices.
I think then some combination of thresholding with these three functions will probably get you there. Give it a try and if you’re still stuck let us know.
Thank you for your suggestions. I finally had the chance to try the suggested methods, but out of the three functions, the first one mne.SourceEstimate.extract_label_time_course
does not work for me, which I think to be the most important one.
First, I computed the vol_source_space using my subject’s fsaverage data and then passed the vol_source_space to the extract_label_time_course of my stc object. I also passed aparc.a2009s+aseg.mgz for the labels to the extract_label_time_course as follows:
File "<decorator-gen-287>", line 24, in extract_label_time_course
File "C:\Users\Aqil\anaconda3\envs\mne\lib\site-packages\mne\source_estimate.py", line 588, in extract_label_time_course
return extract_label_time_course(
File "<decorator-gen-309>", line 24, in extract_label_time_course
File "C:\Users\Aqil\anaconda3\envs\mne\lib\site-packages\mne\source_estimate.py", line 3222, in extract_label_time_course
label_tc = list(label_tc)
File "C:\Users\Aqil\anaconda3\envs\mne\lib\site-packages\mne\source_estimate.py", line 3123, in _gen_extract_label_time_course
label_vertidx, src_flip = _prepare_label_extraction(
File "C:\Users\Aqil\anaconda3\envs\mne\lib\site-packages\mne\source_estimate.py", line 2894, in _prepare_label_extraction
_check_stc_src(stc, src)
File "C:\Users\Aqil\anaconda3\envs\mne\lib\site-packages\mne\source_estimate.py", line 2876, in _check_stc_src
raise ValueError('%d/%d %s hemisphere stc vertices '
ValueError: 3391/4095 left hemisphere stc vertices missing from the source space, likely mismatch
I have used both a morphed stc and a non-morphed stc with the subject’s mri data and fsaveragemri data, respectively, and I received a similar error in both scenarios.
@aqil.izadysadr it’s difficult to debug without the data. Can you try to simplify your code as much as possible and replicate using just the MNE-Python sample dataset and subject? If you can do it with that and post your code here, we can more easily see what’s going wrong and fix it
Thank you for your response! I will try it with the MNE-Python sample dataset and subject and will share my code here soon.
Basically, I only have one stc object (which is morphed), and I am trying to use the same fsaverage data, which was used to morph the stc, to calculate the src and labels, but when I pass all these objects to the mne.extract_label_time_course() function, I get the above error.
Using the MNE-Python sample dataset and subject was a great idea! I think that I finally managed to plot cortical activity only in one label (ROI) across time using my morphed stc. I used extracting time course from source space estimate and the cortical parcellation to achieve this. Interestingly, there was no need for src and mne.extract_label_time_course(). Now, it is possible to get the stc mean as well.