Precompute voxel neighbors and distances for each surface vertex so that repeated volume-to-surface projections (e.g., 4D time series) can be done quickly without rebuilding nearest-neighbor searches.
Usage
surface_sampler(
surf_wm,
surf_pial,
vol_template,
mask = NULL,
sampling = c("midpoint", "normal_line", "thickness"),
n_samples = NULL,
depth = NULL,
radius = 3,
knn = 6,
dthresh = 16
)Arguments
- surf_wm
White-matter (inner) surface,
SurfaceGeometry.- surf_pial
Pial (outer) surface,
SurfaceGeometry.- vol_template
A
NeuroVolused to define voxel space and candidate voxels (viamaskor non-zero entries).- mask
Optional mask limiting candidate voxels; if
NULL, all non-zero voxels invol_templateare used.- sampling
How to place sample points relative to the white/pial pair. Options are:
"midpoint" (default): original behaviour, samples at the midpoint between white and pial.
"thickness": samples along the white→pial line at fractions given by
depthor evenly spaced."normal_line": samples along the vertex normal centred on the midpoint, spanning
radiusin both directions (or usingdepthoffsets).
- n_samples
Number of samples per vertex for
sampling != "midpoint"whendepthis not supplied.- depth
Optional numeric vector controlling sampling positions; interpreted as fractions of thickness (for "thickness") or multiples of
radius(for "normal_line").- radius
Radius (in voxel units) for normal-line sampling when
sampling = "normal_line"; also used as the distance scale when interpretingdepthoffsets for that mode.- knn
The number of nearest neighbors to consider for mapping (default: 6).
- dthresh
The maximum distance threshold for valid mapping. A voxel is only considered if it is less than
dthreshunits away from the vertex (default: 2 * sigma).