(self)
| 1568 | self._dig_dict[k] = np.array([self._dig_dict[k]], float) |
| 1569 | |
| 1570 | def _setup_bem(self): |
| 1571 | # find high-res head model (if possible) |
| 1572 | high_res_path = _find_head_bem(self._subject, self._subjects_dir, high_res=True) |
| 1573 | low_res_path = _find_head_bem(self._subject, self._subjects_dir, high_res=False) |
| 1574 | if high_res_path is None and low_res_path is None: |
| 1575 | raise RuntimeError( |
| 1576 | "No standard head model was " |
| 1577 | f"found for subject {self._subject} in " |
| 1578 | f"{self._subjects_dir}" |
| 1579 | ) |
| 1580 | if high_res_path is not None: |
| 1581 | self._bem_high_res = _read_surface( |
| 1582 | high_res_path, on_defects=self._on_defects |
| 1583 | ) |
| 1584 | logger.info(f"Using high resolution head model in {high_res_path}") |
| 1585 | else: |
| 1586 | self._bem_high_res = _read_surface( |
| 1587 | low_res_path, on_defects=self._on_defects |
| 1588 | ) |
| 1589 | logger.info(f"Using low resolution head model in {low_res_path}") |
| 1590 | if low_res_path is None: |
| 1591 | # This should be very rare! |
| 1592 | warn( |
| 1593 | "No low-resolution head found, decimating high resolution " |
| 1594 | f"mesh ({len(self._bem_high_res['rr'])} vertices): {high_res_path}" |
| 1595 | ) |
| 1596 | # Create one from the high res one, which we know we have |
| 1597 | rr, tris = decimate_surface( |
| 1598 | self._bem_high_res["rr"], self._bem_high_res["tris"], n_triangles=5120 |
| 1599 | ) |
| 1600 | # directly set the attributes of bem_low_res |
| 1601 | self._bem_low_res = complete_surface_info( |
| 1602 | dict(rr=rr, tris=tris), copy=False, verbose=False |
| 1603 | ) |
| 1604 | else: |
| 1605 | self._bem_low_res = _read_surface(low_res_path, on_defects=self._on_defects) |
| 1606 | |
| 1607 | def _setup_fiducials(self, fids): |
| 1608 | _validate_type(fids, (str, dict, list)) |
no test coverage detected