RawVoxelFeatures

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 RawVoxelFeatures(modalities: Sequence[str] = (), roi: str | None = None, modality: str | None = None, as_: str | None = None)[source]

Bases: object

Per-voxel raw intensity of every requested modality inside the ROI.

This is the simplest possible VoxelFeatureExtractor and serves as the reference implementation for the protocol: one subject in, one VoxelFeatureField out, with geometry validated before any computation.

Parameters:
  • modality – Single modality key – the explicit form used inside feature trees (raw("T1")). Mutually exclusive with modalities.

  • modalities – Modality keys to read from the subject, in feature order – the historical convenience that stacks several modalities into one node without a concat combiner.

  • as – Optional output-column alias. Valid only with exactly one resolved modality; the column is then named after the alias instead of the modality.

  • roi – Mask key defining the region of interest; None uses the subject’s single mask.

__init__(modalities: Sequence[str] = (), roi: str | None = None, modality: str | None = None, as_: str | None = None) → None[source]
property spec: Spec

Return the algorithm specification used for provenance.

__call__(subject: Subject) → VoxelFeatureField[source]

Compute per-voxel intensities for one subject.

Parameters:

subject – Subject providing the requested modalities and mask.

Returns:

One row per ROI voxel, one column per modality (named after the source label: the as_ alias when given, else the modality).

Raises:
  • KeyError – If a modality or the ROI is absent on the subject.

  • GeometryError – If a modality and the mask do not share a grid.

Examples using habit.voxel_features.RawVoxelFeatures

Load from NumPy arrays

Load from NumPy arrays

Feature preprocessing

Feature preprocessing

Supervoxel feature extraction and acceleration

Supervoxel feature extraction and acceleration

Extracting voxel intensities

Extracting voxel intensities

Preprocessing features before clustering

Preprocessing features before clustering

Partitioning a ROI into supervoxels

Partitioning a ROI into supervoxels

Fitting a cohort habitat model

Fitting a cohort habitat model

Assigning habitat labels

Assigning habitat labels

Matching maps of the same voxels by overlap

Matching maps of the same voxels by overlap