[Mne_analysis] Generating labels with mne_python

Martin Luessi mluessi at nmr.mgh.harvard.edu
Wed Aug 7 14:24:06 EDT 2013
Search archives:

Hi Luke,

MNE-Python currently doesn't have a function that does exactly what you 
want, but it should be possible to put something together to get the 
desired result. I would do something like this:

1) Use mne.spatial_src_connectivity to get a connectivity matrix that 
describes the neighbor relations in source space. The "src" parameter is 
the source space, e.g., "inv['src']", where inv is your inverse operator.

2) Use mne.stats._find_clusters and pass in "stc.data[:, idx]" where idx 
selects a single time point. This function will return a list of 
clusters (connected components)

3) For each cluster, generate a SourceEstimate using the original source 
space (so stc_cluster.vertices is the same as in stc). Set the data of 
stc_cluster to all-zero except inside the cluster (use e.g. 1.0). Pass 
stc_cluster to mne.stc_to_label to generate a Label from it. Save the 
labels, add it to a list, etc.

I hope this helps,

Martin

On 08/07/13 13:57, Luke Bloy wrote:
> Hi all,
>
> I am interested in generating a label from an stc. What I would like is
> to be able to supply a seed and a threshold, and to get as output a
> label consisting of the source points  connected to the seed and above
> threshold. Basically I’d like to be able to compute connected components
> on stcs. Has this been implemented? If not could someone maybe help me
> out by pointing to how I could get neighborhood information from the src
> space? Alternatively, can someone think of a way to combine thresholding
> stc.data with mne.label.grow_label to do what I want?
>
> A second easier question. Is there an simple way to show labels on a
> pysurfer plot. At the moment I’m generating the label, then saving it to
> disk and using ‘brain.add_label’ to load the label from disk. Is there a
> more straight forward way that I’m missing.
>
> Thanks
>
> Luke
>
>
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>


-- 
Martin Luessi, Ph.D.

Research Fellow

Department of Radiology
Athinoula A. Martinos Center for Biomedical Imaging
Massachusetts General Hospital
Harvard Medical School
149 13th Street
Charlestown, MA 02129

Fax: +1 617 726-7422



More information about the Mne_analysis mailing list