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

Function _prep_label_split

mne/label.py:1221–1243  ·  view source on GitHub ↗

Get label and subject information prior to label splitting.

(label, subject=None, subjects_dir=None)

Source from the content-addressed store, hash-verified

1219
1220
1221def _prep_label_split(label, subject=None, subjects_dir=None):
1222 """Get label and subject information prior to label splitting."""
1223 # If necessary, find the label
1224 if isinstance(label, BiHemiLabel):
1225 raise TypeError("Can only split labels restricted to one hemisphere.")
1226 elif isinstance(label, str):
1227 label = read_label(label)
1228
1229 # Find the subject
1230 subjects_dir = str(get_subjects_dir(subjects_dir, raise_error=True))
1231 if label.subject is None and subject is None:
1232 raise ValueError("The subject needs to be specified.")
1233 elif subject is None:
1234 subject = label.subject
1235 elif label.subject is None:
1236 pass
1237 elif subject != label.subject:
1238 raise ValueError(
1239 f"The label specifies a different subject ({repr(label.subject)}) from "
1240 f"the subject parameter ({repr(subject)})."
1241 )
1242
1243 return label, subject, subjects_dir
1244
1245
1246def _split_label_contig(label_to_split, subject=None, subjects_dir=None):

Callers 2

_split_label_contigFunction · 0.85
split_labelFunction · 0.85

Calls 2

read_labelFunction · 0.85
get_subjects_dirFunction · 0.85

Tested by

no test coverage detected