Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dongqunxi/daca753366c592927ff789c03aa6ed0b to your computer and use it in GitHub Desktop.
Save dongqunxi/daca753366c592927ff789c03aa6ed0b to your computer and use it in GitHub Desktop.
Get functional labels with the help of spatial-temporal clustering.
# Generate source_estimate from significant clusters
stc = summarize_clusters_stc(clu, p_thre, tstep=tstep,
tmin=tmin, vertices=fsave_vertices,
subject='fsaverage')
# Generate thresholded source estimate
stc_sub = stc.copy().mean()
data = np.zeros(stc_sub.data.shape)
data[:, 0] = stc.data[:, 0]
abs_data = abs(data)
abs_data[abs_data < thr] = 0
stc_sub.data.setfield(abs_data, np.float32)
# Generate functional labels
lh_labels, rh_labels = mne.stc_to_label(stc_sub, src=src, smooth=True,
subjects_dir=subjects_dir, connected=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment