find_nv_kdtree: Find nearest mesh vertex for query coordinates using kdtree.

View source: R/kdtree.R

find_nv_kdtreeR Documentation

Find nearest mesh vertex for query coordinates using kdtree.

Description

Find nearest mesh vertex for query coordinates using kdtree.

Usage

find_nv_kdtree(query_coordinates, mesh, threads = parallel::detectCores())

Arguments

query_coordinates

nx3 numerical matrix of x,y,z coordinates. These are typically the vertex positions of a second (spherical!) mesh for that you need per-vertex data (e.g., the fsaverage6 mesh).

mesh

fs.surface instance, see read.fs.surface or subject.surface to get one, or turn an rgl tmesh into one with tmesh3d.to.fs.surface.

threads

integer, the number of threads to run in parallel.

Value

named list with keys 'index' and 'distance'. 'index': integer vector, the n vertex indices which are closest to the nx3 matrix of query_coordinates. 1-based indices for R are returned. 'distance': double vector, the distances to the respective vertices in the 'index' key.

Note

@note The mesh must be spherical, and the query_coordinates must be located on the mesh sphere.

See Also

https://github.com/ThomasYeoLab/CBIG/blob/master/external_packages/SD/SDv1.5.1-svn593/BasicTools/MARS_findNV_kdTree.m


dfsp-spirit/haze documentation built on Feb. 28, 2023, 11:45 p.m.