Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from __future__ import print_function
- import mne
- data_path = mne.datasets.sample.data_path()
- subjects_dir = data_path + '/subjects'
- subject = 'sample'
- fname_inv = data_path + '/MEG/sample/sample_audvis-meg-oct-6-meg-inv.fif'
- # Read the source space. Normally, you would use mne.read_source_spaces for
- # this, but the sample data does not include a '-src.fif' file. Therefore, in
- # this example, we take it from the inverse operator.
- inverse_operator = mne.minimum_norm.read_inverse_operator(fname_inv)
- src = inverse_operator['src'] # get the source space
- # Read a label
- aparc_label_name = 'bankssts-lh'
- label = mne.read_labels_from_annot(subject, parc='aparc',
- subjects_dir=subjects_dir,
- regexp=aparc_label_name)[0]
- # The source space contains a distance matrix that measures the distance (in
- # meters) from each vertex to each other vertex.
- hemi = 0 # Left hemisphere
- dist = src[hemi]['dist']
- # Reduce the distance matrix to only the vertices present in the label
- label_dist = dist[label.vertices, :][:, label.vertices]
- # How big is the label? Here, defined as the maximum distance between two
- # vertices in the label.
- print('Size of the label:', label_dist.max(), 'm')
- # Or in milimeters
- print('Size of the label:', label_dist.max() * 1000, 'mm')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement