knn_shrink: knn_shrink

View source: R/supervoxels.R

knn_shrinkR Documentation

knn_shrink

Description

Replace each voxel by the mean of its k nearest neighbors in its local spatial neighborhood

Usage

knn_shrink(bvec, mask, k = 5, connectivity = 27)

Arguments

bvec

bvec a NeuroVec instance

mask

a mask defining the voxels to include in the clustering result.

k

the number of nearest neighbors to average over.

connectivity

the number of spatial neighbors to include in the search space around each voxel.

Examples

mask <- NeuroVol(array(1, c(20,20,20)), NeuroSpace(c(20,20,20)))
bvec <- replicate(10, NeuroVol(array(runif(20*20*20), c(20,20,20)),
NeuroSpace(c(20,20,20))), simplify=FALSE)
bvec <- do.call(concat, bvec)

sbvec <- knn_shrink(bvec, mask,k=3)


bbuchsbaum/neurocluster documentation built on April 1, 2024, 8:43 p.m.