Supervoxelization
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 Supervoxelization(subject_id: str, label_array: ndarray, features: DataFrame, geometry: Geometry, provenance: Provenance)[source]
Bases:
objectWithin-subject partition of the ROI into supervoxels, plus their features.
Scientific role: supervoxels denoise voxel-level features and reduce the clustering unit from a single voxel to a coherent local region, which is the first step of the
two_stepstrategy.- label_array
Supervoxel id per voxel, shape equal to the ROI grid;
0denotes voxels outside the ROI.- Type:
- features
Index is supervoxel id, columns are aggregated features. This is the payload that a federated deployment would transmit instead of the images themselves.
- Type:
pandas.core.frame.DataFrame
- geometry
Grid
label_arrayrefers to.
- provenance
How this partition was produced.
- feature_frame() DataFrame[source]
Return the bare unit-by-feature matrix.
The counterpart of
VoxelFeatureField.feature_frame(), so one implementation of a matrix-level operation serves both granularities. Here the frame is already the native representation; the supervoxel index is dropped to a positional one so callers cannot accidentally depend on label values during a column-wise computation.- Returns:
Feature matrix with a positional index, in column order.
- with_feature_frame(frame: DataFrame, *, produced_by: str, spec_fingerprint: str) Supervoxelization[source]
Return a copy carrying a recomputed feature matrix.
- Parameters:
frame – Replacement matrix, row-aligned with the current features. Columns may be fewer; the row count must match, since each row still describes one label of
label_array.produced_by – Provenance label of the step that produced
frame.spec_fingerprint – Fingerprint of that step’s specification.
- Returns:
label_arrayis inherited unchanged, because describing supervoxels never redraws them.- Return type:
A new partition with the same regions described differently
- Raises:
HABITAPIError – If
framehas a different number of rows.