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

Function _get_annot_fname

mne/label.py:2207–2232  ·  view source on GitHub ↗

Get the .annot filenames and hemispheres.

(annot_fname, subject, hemi, parc, subjects_dir)

Source from the content-addressed store, hash-verified

2205
2206
2207def _get_annot_fname(annot_fname, subject, hemi, parc, subjects_dir):
2208 """Get the .annot filenames and hemispheres."""
2209 if annot_fname is not None:
2210 # we use use the .annot file specified by the user
2211 hemis = [op.basename(annot_fname)[:2]]
2212 if hemis[0] not in ["lh", "rh"]:
2213 raise ValueError(
2214 "Could not determine hemisphere from filename, "
2215 'filename has to start with "lh" or "rh".'
2216 )
2217 annot_fname = [annot_fname]
2218 else:
2219 # construct .annot file names for requested subject, parc, hemi
2220 _check_option("hemi", hemi, ["lh", "rh", "both"])
2221 if hemi == "both":
2222 hemis = ["lh", "rh"]
2223 else:
2224 hemis = [hemi]
2225
2226 subjects_dir = get_subjects_dir(subjects_dir, raise_error=True)
2227 annot_fname = [
2228 str(subjects_dir / subject / "label" / f"{hemi_}.{parc}.annot")
2229 for hemi_ in hemis
2230 ]
2231
2232 return annot_fname, hemis
2233
2234
2235def _load_vert_pos(subject, subjects_dir, surf_name, hemi, n_expected, extra=""):

Callers 2

read_labels_from_annotFunction · 0.85
write_labels_to_annotFunction · 0.85

Calls 2

_check_optionFunction · 0.85
get_subjects_dirFunction · 0.85

Tested by

no test coverage detected