If you have a question or issue with MNE-Python, please include the following info:
- MNE-Python version: 0.23.0
- operating system: OS
I want to vertically concatenate my stc files. I have obtained stc’s of my data corresponding to each HCP parcellation and I want to create a single stc file that contains data of a particular brain region (i.e., broca).
I already have tried this function, using np.vstack to concatenate them:
def return_the_roi_data_stcFormat(brain_region, s_date, s_name, n_stim, stim_index):
roi_lbl_list = []
if(brain_region == "soma_motor"):
roi_lbl_list = soma_motor
if(brain_region == "v4"):
roi_lbl_list = v4_area_lbls
if(brain_region == "v3"):
roi_lbl_list = v3_area_lbls
if(brain_region == "v2"):
roi_lbl_list = v2_area_lbls
if(brain_region == "v1"):
roi_lbl_list = v1_area_lbls
if(brain_region == "Wernicke"):
roi_lbl_list = Wernicke_area_lbls
if(brain_region == "broca"):
roi_lbl_list = broca_area_lbls
stc_sm = []
firstTime_stim = True
i_stim = stim_index
firstTime_lbl = True
stc_lbl = []
for lbl in roi_lbl_list:
fname_dir = os.path.join(hcplabeled_dir_parent, s_date, s_name, lbl)
suffix = lbl[-3:]
stc_tmp = mne.read_source_estimate(os.path.join(fname_dir, "stc_" + str(i_stim) + "_" + lbl + suffix +".stc"))
if(firstTime_lbl):
stc_lbl = stc_tmp
firstTime_lbl = False
else:
stc_lbl = np.vstack((stc_lbl, stc_tmp))
return stc_lbl
but the results will be like this:
array([[<SourceEstimate | 77 vertices, tmin : -100.0 (ms), tmax : 450.00000000000006 (ms), tstep : 1.0 (ms), data shape : (77, 551), ~167 kB>],
[<SourceEstimate | 72 vertices, tmin : -100.0 (ms), tmax : 450.00000000000006 (ms), tstep : 1.0 (ms), data shape : (72, 551), ~156 kB>],
[<SourceEstimate | 103 vertices, tmin : -100.0 (ms), tmax : 450.00000000000006 (ms), tstep : 1.0 (ms), data shape : (103, 551), ~223 kB>],
[<SourceEstimate | 61 vertices, tmin : -100.0 (ms), tmax : 450.00000000000006 (ms), tstep : 1.0 (ms), data shape : (61, 551), ~132 kB>],
[<SourceEstimate | 61 vertices, tmin : -100.0 (ms), tmax : 450.00000000000006 (ms), tstep : 1.0 (ms), data shape : (61, 551), ~132 kB>],
[<SourceEstimate | 59 vertices, tmin : -100.0 (ms), tmax : 450.00000000000006 (ms), tstep : 1.0 (ms), data shape : (59, 551), ~128 kB>],
[<SourceEstimate | 49 vertices, tmin : -100.0 (ms), tmax : 450.00000000000006 (ms), tstep : 1.0 (ms), data shape : (49, 551), ~106 kB>],
[<SourceEstimate | 74 vertices, tmin : -100.0 (ms), tmax : 450.00000000000006 (ms), tstep : 1.0 (ms), data shape : (74, 551), ~160 kB>],
[<SourceEstimate | 51 vertices, tmin : -100.0 (ms), tmax : 450.00000000000006 (ms), tstep : 1.0 (ms), data shape : (51, 551), ~110 kB>],
[<SourceEstimate | 34 vertices, tmin : -100.0 (ms), tmax : 450.00000000000006 (ms), tstep : 1.0 (ms), data shape : (34, 551), ~74 kB>]],
dtype=object)
I want it to be a single stc file. How should I do that?