Learn R Programming

neuroim2 (version 0.8.5)

random_searchlight: Create a spherical random searchlight iterator

Description

This function generates a spherical random searchlight iterator for analyzing local neighborhoods of voxels within a given radius in a brain mask.

Usage

random_searchlight(mask, radius, nonzero = TRUE)

Value

A list of ROIVolWindow objects, each representing a spherical searchlight region.

Arguments

mask

A NeuroVol object representing the brain mask.

radius

A numeric value specifying the radius of the searchlight sphere in voxel units.

nonzero

Logical; if TRUE (default) discard zero-valued voxels in the mask when forming each searchlight.

Examples

Run this code
# Create a simple brain mask
mask_data <- array(TRUE, c(10, 10, 10))
mask_data[1, 1, 1] <- FALSE
mask <- LogicalNeuroVol(mask_data, NeuroSpace(c(10,10,10)))

# Generate random searchlight iterator with a radius of 2 voxels
# \donttest{
searchlights <- random_searchlight(mask, radius = 6)
# }

Run the code above in your browser using DataLab