KMeansSupervoxelizer

Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

class KMeansSupervoxelizer(n_supervoxels: int = 50, max_iter: int = 300, n_init: int = 10)[source]

Bases: object

Partition the ROI by k-means over voxel features.

The v0.1 default supervoxel algorithm for the two-step design.

Parameters:
  • n_supervoxels – Requested number of supervoxels, clamped to the ROI voxel count.

  • max_iter – Maximum k-means iterations per restart.

  • n_init – Number of k-means restarts.

__init__(n_supervoxels: int = 50, max_iter: int = 300, n_init: int = 10) → None[source]
property spec: Spec

Return the algorithm specification.

set_random_state(seed: int) → None[source]

Set the seed applied to k-means initialisation.

__call__(field: VoxelFeatureField) → Supervoxelization[source]

Cluster the subject’s voxels into supervoxels.

Parameters:

field – Per-voxel features for one subject.

Returns:

The supervoxel partition summarised by feature means.

Examples using habit.supervoxel.KMeansSupervoxelizer

Feature preprocessing

Feature preprocessing