supervoxels | R Documentation |
Cluster a NeuroVec
instance into a set of spatially constrained clusters.
supervoxels(
bvec,
mask,
K = 500,
sigma1 = 1,
sigma2 = 2.5,
iterations = 50,
connectivity = 27,
use_medoid = FALSE,
use_gradient = TRUE,
alpha = 0.5
)
bvec |
a |
mask |
a |
K |
the number of clusters to find. |
sigma1 |
the bandwidth of the heat kernel for computing similarity of the data vectors. |
sigma2 |
the bandwidth of the heat kernel for computing similarity of the coordinate vectors. If this value is small, then relatively larger weights are given to nearby voxels. If is is large, then spatial weights will be less salient. A relatively large sigma1/sigma2 ratio weights data features more than spatial features, whereas as large sigma2/sigma1 ration does the opposite. |
iterations |
the maximum number of cluster iterations |
connectivity |
the number of nearest neighbors defining the neighborhood |
use_medoid |
whether to use the medoids to define cluster centroids |
use_gradient |
use the image gradient to initialize clusters |
alpha |
the relative weighting between spatial coherence and feature similarity metrics. alpha = 1, means all feature-weighting, alpha=0 is spatial weighting. Default is .5. |
Here's a brief overview of the algorithm: 1. It first scales input data (bvec)
2. It initializes the clusters using the gradient of the image and a furthest neighbor approach.
3. It then runs the "supervoxel_fit" function, which iteratively finds spatially constrained clusters using a combination of feature similarity and spatial similarity. The feature similarity is calculated based on the heat kernel with bandwidth sigma1, while the spatial similarity is calculated based on the heat kernel with bandwidth sigma2. The relative weighting between these two similarities is controlled by the alpha parameter.
4. Finally, it returns a list containing the clustered NeuroVol object (clusvol), cluster assignments for each voxel (cluster), the feature vector for each cluster (centers), and the spatial coordinates of each cluster (coord_centers). This algorithm is particularly suitable for brain data analysis, as it takes both the spatial and feature similarities into account, allowing it to identify clusters that are spatially coherent and share similar features.
a list
of class supervoxels_cluster_result
with the following elements:
an instance of type ClusteredNeuroVol
a vector of cluster indices equal to the number of voxels in the mask
a matrix of cluster centers with each column representing the feature vector for a cluster
a matrix of spatial coordinates with each row corresponding to a cluster
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)
cres1 <- supervoxels(bvec, mask, K=100, sigma1=1, sigma2=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.