Skip to content

Function: partition() ​

ts
function partition(
   x, 
   k, 
   method?, 
   mask?, 
   seed?): ClusteredNeuroVol;

Defined in: src/stats/stats.ts:722

Partition a volume into k regions using clustering.

Uses clustering algorithms to partition the brain volume into k distinct regions based on voxel values.

Parameters ​

x ​

NeuroVol

The volume to partition

k ​

number

Number of partitions/clusters

method? ​

string = 'kmeans'

Clustering method (currently only "kmeans")

mask? ​

LogicalNeuroVol

Optional mask to restrict clustering to specific voxels

seed? ​

number = 1

Seed for the k-means++ initialisation (default 1); the same seed gives the same partition. Must be finite.

Returns ​

ClusteredNeuroVol

Clustered volume with partition labels

Throws ​

If seed is NaN or infinite.

Released under the MIT License.