Read data of stc in labels

  • MNE version: MNE1.0.0
  • operating system: CentOS release 6.5 (Final)

Hi! guys,
I want to extract data from stc time courses based on an atlas, like Wang(2015) atlas https://academic.oup.com/cercor/article/25/10/3911/393661?login=true. Here is what I did:

  1. I get the files lh.mgz and rh.mgz contain the vertex overlays of the Wang(2015) atlas on the fsaverage surface;
  2. get the labels from this two mgz files:
export roiname_array=(1 "V1v" "V1d" "V2v" "V2d" "V3v" "V3d" "hV4" "VO1" "VO2" "PHC1" "PHC2" \

    "TO2" "TO1" "LO2" "LO1" "V3B" "V3A" "IPS0" "IPS1" "IPS2" "IPS3" "IPS4" \

    "IPS5" "SPL1" "FEF")

export subjid=sub-fsaverage

for i in {1..25}

do

 mri_cor2label --i ${data_dir}/surf/lh.wang2015_atlas.mgz --id ${i} --l ${label_dir}/wang2015atlas.${roiname_array[${i}]}.lh.label --surf ${subjid} lh inflated

 mri_cor2label --i ${data_dir}/surf/rh.wang2015_atlas.mgz --id ${i} --l ${label_dir}wang2015atlas.${roiname_array[${i}]}.rh.label --surf ${subjid} rh inflated

done
  1. I tried to get stc constrained in the labels I got in step 2) of each subject :
rois_name =['V1v', 'V1d', 'V2v', 'V2d', 'V3v', 'V3d', 'hV4', 'VO1', 'VO2', 'PHC1', 'PHC2',

    'TO2', 'TO1', 'LO2', 'LO1', 'V3B', 'V3A', 'IPS0', 'IPS1', 'IPS2', 'IPS3', 'IPS4',

    'IPS5', 'SPL1', 'FEF']

fsaverage_dir = '/brain/guixue/zhouyu/proj01/mri/fmriprep/derivatives/freesurfer/sub-fsaverage/'
hemi = ['lh', 'rh']


snr = 3.
lambda2 = 1. / snr ** 2

for r in rois_name:
    for h in hemi:
        stc, stc_data, residual  = {}, {}, {}

        # project all evoked data to this roi
        for evo_key, evo_val in evoked.items():
            fname_label = fsaverage_dir + 'label/wang2015/wang2015atlas.{}.{}.label'.format(r, h)
            label = read_label(fname_label)

            stc[evo_key], residual[evo_key] = apply_inverse(evo_val, inverse_operator, lambda2=lambda2, method='MNE', pick_ori='normal', prepared=False, label=label, method_params=None, return_residual=True, verbose=None)

            stc_data[evo_key] = stc[evo_key].data
        
        stc_data_keys = np.asarray(list(stc_data.keys()))
        stc_data_vals = np.asarray(list(stc_data.values()))

I think step3) above might be wrong cause I cannot apply the labels obtained from fsaverage surface to each subject directly. Maybe I should morph the subject stc to fsaverage space using mne.compute_source_morph mne.compute_source_morph — MNE 1.1.dev0 documentation. In this case, the label obtained from fsaverage can be applied to the subject considering I morph the subjects’s source estimate to fsaverage space. Did this sound right?

@YuZhou - I don’t think this is directly answering your question, but can you just map the labels to the single subject space and extract the label information from the single subject space.

Step2:

export subjid=SUBJECT1  #Map labels to subjid - then iterate over subjects
...

Step3:

...
subjid = SUBJECT1 #Again iterate over subjects once you create the labels
subjects_dir=os.environ['SUBJECTS_DIR']
fname_label = f'{subjects_dir}/{subjid}/lalbe/wang2015/wang2015atlas.{r}.{h}.label'
...

This should give you the same answer without needed to warp to fsaverage. Don’t know if this helps/works but its worth a shot.

1 Like

Hi! Jeff, thank you so much for your reply.
I think your solutions is reasonable and good :blush: :+1: :+1:
So there might be two ways:

  1. map the atlas to each subject’s native space and then extract the labels;
  2. map the atlas to fsaverage space and extract the labels; then morph/map subject’s source estimates to the labels from the fsaverage space.

I compared the results from these two methods, the results from the first method looked better.