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

Function transform_surface_to

mne/transforms.py:652–688  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

650
651
652def 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
691def get_ras_to_neuromag_trans(nasion, lpa, rpa):

Callers 10

_make_openmeeg_geometryFunction · 0.85
get_meg_helmet_surfFunction · 0.85
fit_dipoleFunction · 0.85
_make_surface_mappingFunction · 0.85
_transform_toMethod · 0.85
_iter_forward_solutionsFunction · 0.85
plot_head_positionsFunction · 0.85
plot_alignmentFunction · 0.85
_plot_head_surfaceFunction · 0.85
_plot_helmetFunction · 0.85

Calls 2

_ensure_transFunction · 0.85
apply_transFunction · 0.85

Tested by

no test coverage detected