Partition an image into a set of disjoint clusters
Source:R/all_generic.R
, R/neurovol.R
partition-methods.Rd
This function partitions an image into a set of disjoint clusters using k-means clustering.
Usage
partition(x, k, ...)
# S4 method for LogicalNeuroVol,integer
partition(x, k)
# S4 method for LogicalNeuroVol,numeric
partition(x, k)
# S4 method for DenseNeuroVol,numeric
partition(x, k)
Arguments
- x
the image to partition, represented as a 3D array.
- k
the number of clusters to form.
- ...
additional arguments passed to the kmeans function.
Examples
# 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)