SubjectFeaturePreprocessor

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 SubjectFeaturePreprocessor(*args, **kwargs)[source]

Bases: Protocol

Preprocess one subject’s feature matrix using only that subject’s data.

Stateless by construction: every statistic comes from the matrix passed in, so there is nothing to fit, nothing to persist, and no way to leak training information into a validation subject. This is what makes the protocol a plain callable rather than a fit/transform pair.

Deliberately says nothing about granularity. The matrix rows may be voxels or supervoxels, and the SAME implementation serves both – which is the whole reason this is separate from CohortFeaturePreprocessor rather than being one protocol per pipeline position. Scientifically the purpose is to remove BETWEEN-subject variation (scanner, sequence, intensity scale), and that only works when each subject is normalised by its own distribution.

A plain DataFrame is the input and output type because the computation is genuinely type-agnostic; the typed contracts bridge to it through their feature_frame() / with_feature_frame() pair.

property spec: Spec

Return the algorithm specification.

__call__(block: DataFrame) → DataFrame[source]

Preprocess one unit-by-feature matrix.

Parameters:

block – Rows are clustering units (voxels or supervoxels) of ONE subject, columns are features.

Returns:

The preprocessed matrix with the same rows in the same order. Columns may be a subset when the chain filters features.

__init__(*args, **kwargs)