partition-methods: Partition an image into a set of disjoint clusters

partitionR Documentation

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 signature 'LogicalNeuroVol,integer'
partition(x, k)

## S4 method for signature 'LogicalNeuroVol,numeric'
partition(x, k)

## S4 method for signature '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.

Value

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

See Also

kmeans

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)



bbuchsbaum/neuroim2 documentation built on March 29, 2024, 6:36 p.m.