Find all files of an mri relevant for source transformation. Parameters ---------- subject : str Name of the mri subject. skip_fiducials : bool Do not scale the MRI fiducials. If False, an OSError will be raised if no fiducials file can be found. subjects
(subject, skip_fiducials, subjects_dir)
| 576 | |
| 577 | |
| 578 | def _find_mri_paths(subject, skip_fiducials, subjects_dir): |
| 579 | """Find all files of an mri relevant for source transformation. |
| 580 | |
| 581 | Parameters |
| 582 | ---------- |
| 583 | subject : str |
| 584 | Name of the mri subject. |
| 585 | skip_fiducials : bool |
| 586 | Do not scale the MRI fiducials. If False, an OSError will be raised |
| 587 | if no fiducials file can be found. |
| 588 | subjects_dir : None | path-like |
| 589 | Override the SUBJECTS_DIR environment variable |
| 590 | (sys.environ['SUBJECTS_DIR']) |
| 591 | |
| 592 | Returns |
| 593 | ------- |
| 594 | paths : dict |
| 595 | Dictionary whose keys are relevant file type names (str), and whose |
| 596 | values are lists of paths. |
| 597 | """ |
| 598 | subjects_dir = get_subjects_dir(subjects_dir, raise_error=True) |
| 599 | paths = {} |
| 600 | |
| 601 | # directories to create |
| 602 | paths["dirs"] = [bem_dirname, surf_dirname] |
| 603 | |
| 604 | # surf/ files |
| 605 | paths["surf"] = [] |
| 606 | surf_fname = os.path.join(surf_dirname, "{name}") |
| 607 | surf_names = ( |
| 608 | "inflated", |
| 609 | "white", |
| 610 | "orig", |
| 611 | "orig_avg", |
| 612 | "inflated_avg", |
| 613 | "inflated_pre", |
| 614 | "pial", |
| 615 | "pial_avg", |
| 616 | "smoothwm", |
| 617 | "white_avg", |
| 618 | "seghead", |
| 619 | "smseghead", |
| 620 | ) |
| 621 | if os.getenv("_MNE_FEW_SURFACES", "") == "true": # for testing |
| 622 | surf_names = surf_names[:4] |
| 623 | for surf_name in surf_names: |
| 624 | for hemi in ("lh.", "rh."): |
| 625 | name = hemi + surf_name |
| 626 | path = surf_fname.format( |
| 627 | subjects_dir=subjects_dir, subject=subject, name=name |
| 628 | ) |
| 629 | if os.path.exists(path): |
| 630 | paths["surf"].append(pformat(surf_fname, name=name)) |
| 631 | surf_fname = os.path.join(bem_dirname, "{name}") |
| 632 | surf_names = ("inner_skull.surf", "outer_skull.surf", "outer_skin.surf") |
| 633 | for surf_name in surf_names: |
| 634 | path = surf_fname.format( |
| 635 | subjects_dir=subjects_dir, subject=subject, name=surf_name |
no test coverage detected