Get the .annot filenames and hemispheres.
(annot_fname, subject, hemi, parc, subjects_dir)
| 2205 | |
| 2206 | |
| 2207 | def _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 | |
| 2235 | def _load_vert_pos(subject, subjects_dir, surf_name, hemi, n_expected, extra=""): |
no test coverage detected