MCPcopy
hub / github.com/mne-tools/mne-python / select_source_in_label

Function select_source_in_label

mne/simulation/source.py:24–91  ·  view source on GitHub ↗

Select source positions using a label. Parameters ---------- src : list of dict The source space. label : Label The label. %(random_state)s location : str The label location to choose. Can be 'random' (default) or 'center' to use :func:`mne.La

(
    src,
    label,
    random_state=None,
    location="random",
    subject=None,
    subjects_dir=None,
    surf="sphere",
)

Source from the content-addressed store, hash-verified

22
23@fill_doc
24def select_source_in_label(
25 src,
26 label,
27 random_state=None,
28 location="random",
29 subject=None,
30 subjects_dir=None,
31 surf="sphere",
32):
33 """Select source positions using a label.
34
35 Parameters
36 ----------
37 src : list of dict
38 The source space.
39 label : Label
40 The label.
41 %(random_state)s
42 location : str
43 The label location to choose. Can be 'random' (default) or 'center'
44 to use :func:`mne.Label.center_of_mass` (restricting to vertices
45 both in the label and in the source space). Note that for 'center'
46 mode the label values are used as weights.
47
48 .. versionadded:: 0.13
49 subject : str | None
50 The subject the label is defined for.
51 Only used with ``location='center'``.
52
53 .. versionadded:: 0.13
54 %(subjects_dir)s
55
56 .. versionadded:: 0.13
57 surf : str
58 The surface to use for Euclidean distance center of mass
59 finding. The default here is "sphere", which finds the center
60 of mass on the spherical surface to help avoid potential issues
61 with cortical folding.
62
63 .. versionadded:: 0.13
64
65 Returns
66 -------
67 lh_vertno : list
68 Selected source coefficients on the left hemisphere.
69 rh_vertno : list
70 Selected source coefficients on the right hemisphere.
71 """
72 lh_vertno = list()
73 rh_vertno = list()
74 _check_option("location", location, ["random", "center"])
75
76 rng = check_random_state(random_state)
77 if label.hemi == "lh":
78 vertno = lh_vertno
79 hemi_idx = 0
80 else:
81 vertno = rh_vertno

Callers 1

simulate_sparse_stcFunction · 0.85

Calls 5

_check_optionFunction · 0.85
check_random_stateFunction · 0.85
rng_uniformFunction · 0.85
center_of_massMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected