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

Function _project_onto_surface

mne/surface.py:446–471  ·  view source on GitHub ↗

Project points onto (scalp) surface.

(
    rrs, surf, project_rrs=False, return_nn=False, method="accurate"
)

Source from the content-addressed store, hash-verified

444
445
446def _project_onto_surface(
447 rrs, surf, project_rrs=False, return_nn=False, method="accurate"
448):
449 """Project points onto (scalp) surface."""
450 if method == "accurate":
451 surf_geom = _get_tri_supp_geom(surf)
452 pt_tris = np.empty((0,), int)
453 pt_lens = np.zeros(len(rrs) + 1, int)
454 out = _find_nearest_tri_pts(rrs, pt_tris, pt_lens, reproject=True, **surf_geom)
455 if project_rrs: #
456 out += (np.einsum("ij,ijk->ik", out[0], surf["rr"][surf["tris"][out[1]]]),)
457 if return_nn:
458 out += (surf_geom["nn"][out[1]],)
459 else: # nearest neighbor
460 assert project_rrs
461 idx = _compute_nearest(surf["rr"], rrs)
462 out = (None, None, surf["rr"][idx])
463 if return_nn:
464 surf_geom = _get_tri_supp_geom(surf)
465 nn = _accumulate_normals(
466 surf["tris"].astype(int), surf_geom["nn"], len(surf["rr"])
467 )
468 nn = nn[idx]
469 _normalize_vectors(nn)
470 out += (nn,)
471 return out
472
473
474def _normal_orth(nn):

Callers 4

stc_near_sensorsFunction · 0.85
_bem_specify_elsFunction · 0.85
_plot_sensors_3dFunction · 0.85

Calls 5

_get_tri_supp_geomFunction · 0.85
_find_nearest_tri_ptsFunction · 0.85
_compute_nearestFunction · 0.85
_accumulate_normalsFunction · 0.85
_normalize_vectorsFunction · 0.85

Tested by 1