Skip to contents

This function generates an exhaustive searchlight iterator that returns voxel coordinates for each searchlight sphere within the provided mask. The searchlight iterator visits every non-zero voxel in the mask as a potential center voxel.

This function generates an exhaustive searchlight iterator that returns voxel coordinates for each searchlight sphere within the provided mask. The searchlight iterator visits every non-zero voxel in the mask as a potential center voxel.

Usage

searchlight_coords(mask, radius, nonzero = FALSE, cores = 0)

searchlight(mask, radius, eager = FALSE, nonzero = FALSE, cores = 0)

Arguments

mask

A NeuroVol object representing the brain mask, containing valid central voxels for the roving searchlight.

radius

A numeric value specifying the radius (in mm) of the spherical searchlight.

nonzero

A logical value indicating whether to include only coordinates with nonzero values in the supplied mask (default is FALSE).

cores

An integer specifying the number of cores to use for parallel computation (default is 0, which uses a single core).

eager

A logical value specifying whether to eagerly compute the searchlight ROIs (default is FALSE, which uses lazy evaluation).

Value

A deferred_list object containing matrices of integer-valued voxel coordinates, each representing a searchlight region.

A deferred_list object containing matrices of integer-valued voxel coordinates, each representing a searchlight region.

Examples

# Load an example brain mask
mask <- read_vol(system.file("extdata", "global_mask.nii", package="neuroim2"))

# Generate an exhaustive searchlight iterator with a radius of 6 mm
if (FALSE)  searchlights <- searchlight_coords(mask, radius = 6)


# Load an example brain mask
mask <- read_vol(system.file("extdata", "global_mask.nii", package="neuroim2"))

# Generate an exhaustive searchlight iterator with a radius of 6 mm
if (FALSE) {
searchlights <- searchlight(mask, radius = 6, eager = TRUE)
}