Learn R Programming

neuroim2 (version 0.8.5)

partition: Partition an image into a set of disjoint clusters

Description

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)

Value

a 3D array where each voxel is assigned to a cluster.

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.

See Also

Examples

Run this code
# Load an example 3D image
library(neuroim2)
img <- read_vol(system.file("extdata", "global_mask_v4.nii", package = "neuroim2"))

# Partition the image into 5 clusters using default options
clusters <- partition(img, 5)


Run the code above in your browser using DataLab