Transform surface to the desired coordinate system. Parameters ---------- surf : dict Surface. dest : 'meg' | 'mri' | 'head' | int Destination coordinate system. Can be an integer for using FIFF types. trans : dict | list of dict Transformation to
(surf, dest, trans, copy=False)
| 650 | |
| 651 | |
| 652 | def transform_surface_to(surf, dest, trans, copy=False): |
| 653 | """Transform surface to the desired coordinate system. |
| 654 | |
| 655 | Parameters |
| 656 | ---------- |
| 657 | surf : dict |
| 658 | Surface. |
| 659 | dest : 'meg' | 'mri' | 'head' | int |
| 660 | Destination coordinate system. Can be an integer for using |
| 661 | FIFF types. |
| 662 | trans : dict | list of dict |
| 663 | Transformation to use (or a list of possible transformations to |
| 664 | check). |
| 665 | copy : bool |
| 666 | If False (default), operate in-place. |
| 667 | |
| 668 | Returns |
| 669 | ------- |
| 670 | res : dict |
| 671 | Transformed source space. |
| 672 | """ |
| 673 | surf = deepcopy(surf) if copy else surf |
| 674 | if isinstance(dest, str): |
| 675 | if dest not in _str_to_frame: |
| 676 | raise KeyError( |
| 677 | f'dest must be one of {list(_str_to_frame.keys())}, not "{dest}"' |
| 678 | ) |
| 679 | dest = _str_to_frame[dest] # convert to integer |
| 680 | if surf["coord_frame"] == dest: |
| 681 | return surf |
| 682 | |
| 683 | trans = _ensure_trans(trans, int(surf["coord_frame"]), dest) |
| 684 | surf["coord_frame"] = dest |
| 685 | surf["rr"] = apply_trans(trans, surf["rr"]) |
| 686 | if "nn" in surf: |
| 687 | surf["nn"] = apply_trans(trans, surf["nn"], move=False) |
| 688 | return surf |
| 689 | |
| 690 | |
| 691 | def get_ras_to_neuromag_trans(nasion, lpa, rpa): |
no test coverage detected