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

Method restrict

mne/label.py:526–565  ·  view source on GitHub ↗

Restrict a label to a source space. Parameters ---------- src : instance of SourceSpaces The source spaces to use to restrict the label. name : None | str Name for the new Label (default is self.name). Returns -------

(self, src, name=None)

Source from the content-addressed store, hash-verified

524 return label
525
526 def restrict(self, src, name=None):
527 """Restrict a label to a source space.
528
529 Parameters
530 ----------
531 src : instance of SourceSpaces
532 The source spaces to use to restrict the label.
533 name : None | str
534 Name for the new Label (default is self.name).
535
536 Returns
537 -------
538 label : instance of Label
539 The Label restricted to the set of source space vertices.
540
541 See Also
542 --------
543 Label.fill
544
545 Notes
546 -----
547 .. versionadded:: 0.20
548 """
549 if len(self.vertices) == 0:
550 return self.copy()
551 hemi_src = _get_label_src(self, src)
552 mask = np.isin(self.vertices, hemi_src["vertno"])
553 name = self.name if name is None else name
554 label = Label(
555 self.vertices[mask],
556 self.pos[mask],
557 self.values[mask],
558 self.hemi,
559 self.comment,
560 name,
561 None,
562 self.subject,
563 self.color,
564 )
565 return label
566
567 @verbose
568 def smooth(

Callers 2

test_label_fill_restrictFunction · 0.95
test_label_geometryFunction · 0.80

Calls 3

copyMethod · 0.95
_get_label_srcFunction · 0.85
LabelClass · 0.85

Tested by 2

test_label_fill_restrictFunction · 0.76
test_label_geometryFunction · 0.64