partition | R Documentation |
This function partitions an image into a set of disjoint clusters using k-means clustering.
partition(x, k, ...)
## S4 method for signature 'LogicalNeuroVol,integer'
partition(x, k)
## S4 method for signature 'LogicalNeuroVol,numeric'
partition(x, k)
## S4 method for signature 'DenseNeuroVol,numeric'
partition(x, k)
x |
the image to partition, represented as a 3D array. |
k |
the number of clusters to form. |
... |
additional arguments passed to the kmeans function. |
a 3D array where each voxel is assigned to a cluster.
kmeans
# Load an example 3D image
library(neuroim2)
img <- read_vol(system.file("extdata", "global_mask.nii", package = "neuroim2"))
# Partition the image into 5 clusters using default options
clusters <- partition(img, 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.