Create a Random Searchlight iterator for surface mesh
Source:R/Searchlight.R
RandomSurfaceSearchlight.RdCreates an iterator that randomly samples searchlight regions on a surface mesh using geodesic distance to define regions.
Arguments
- surfgeom
A
SurfaceGeometryobject representing the surface mesh.- radius
Numeric, radius of the searchlight as a geodesic distance in mm. Must be a positive numeric scalar.
- nodeset
Integer vector, optional subset of surface node indices to use. If supplied, must contain more than one index.
- as_deflist
Logical, whether to return a deflist object.
Details
On each call to nextElem, a set of surface nodes is returned.
These nodes index into the vertices of the igraph instance.
When as_deflist=TRUE, the random ordering of centers is fixed when the
object is created. Use set.seed before construction for reproducible
sequences.
Examples
# \donttest{
file <- system.file("extdata", "std.8_lh.smoothwm.asc", package = "neurosurf")
geom <- read_surf(file)
#> loading /private/var/folders/9h/nkjq6vss7mqdl4ck7q1hd8ph0000gp/T/Rtmp0Nbniq/temp_libpath80e31f94425b/neurosurf/extdata/std.8_lh.smoothwm.asc
searchlight <- RandomSurfaceSearchlight(geom, 12)
set.seed(42)
dl <- RandomSurfaceSearchlight(geom, 12, as_deflist=TRUE)
attr(dl[[1]], "center")
#> [1] 561
nodes <- searchlight$nextElem()
length(nodes) > 1
#> [1] TRUE
# }