[Mne_analysis] Reduction of vertices to labels

Eric Larson larson.eric.d at gmail.com
Wed Feb 13 12:05:45 EST 2019
Search archives:

        External Email - Use Caution        

Why would you want this? For display it's useful to have all vertices
filled out. Did you try `stc.plot` with what you already have? 68 vertices
in a stc will look weird with stc.plot(). If you want to limit the STC to
the original ~8000 source vertices (useful for smoothing, used here
<http://mne-tools.github.io/dev/auto_examples/connectivity/plot_mne_inverse_envelope_correlation.html>),
you can do something like:

stc = stc.in_label(mne.Label(src[0]['vertno'], hemi='lh') +
mne.Label(src[1]['vertno'], hemi='rh'))

If you really want to reduce it to a STC with only 68 vertices, you can use
a similar method, but concatenating 68 Label objects (each of which only
have 1 vertex) or 1 left hemi label with 34 vertices (center of mass
vertices of each left hemi label?) and 1 right hemi label with 34 vertices.

Eric


On Tue, Feb 12, 2019 at 4:06 AM Vivek Sharma <vivek.sharma1510 at gmail.com>
wrote:

>         External Email - Use Caution
>
> I have a source estimate file. (stc)
> <SourceEstimate  |  8175 vertices, subject : sub-CC721377_T1w, tmin : 60.0
> (ms), tmax : 239.0 (ms), tstep : 1.0 (ms), data shape : (8175, 180)>
> and label, according to desikan atlas,
> label = mne.read_labels_from_annot('sub-CC721377_T1w', hemi='both',
> parc='aparc', subjects_dir=subjects_dir, regexp=None)
>
>
> I need source points corresponding to labels in variable label. To obtain
> this I use the following line of code:
> abc = mne.extract_label_time_course(stc, label, src, mode='mean_flip',
> allow_empty=False, return_generator=False, verbose=None)
> The output is abc = (68, 180) (matrix)
>
> To generate source file again with this data, I use, mne.labels_to_stc(
> *labels*, *values*, *tmin=0*, *tstep=1*, *subject=None*, *verbose=None*)
> stcc = mne.labels_to_stc(label0, abc, tmin=0, tstep=1,
> subject='sub-CC721377_T1w', verbose=None)
> The output in stcc contains the following data:
> <SourceEstimate  |  296592 vertices, subject : sub-CC721377_T1w, tmin :
> 0.0 (ms), tmax : 179000.0 (ms), tstep : 1000.0 (ms), data shape : (296592,
> 180)>
> stcc.shape
> (296592, 180)
> but the values provided is (68,180) and the labels are also 68, then why
> the number of vertices is 296592.
> How I can I obtain final source estimate file of shape (68,180) i.e., 68
> vertices only
>
> --
> Vivek Sharma
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190213/4f77f17c/attachment.html 


More information about the Mne_analysis mailing list