habit.contracts: in-memory data model
L2 domain data contracts: the vocabulary every HABIT layer speaks.
The guiding rule is that each type must be explainable in the language of habitat imaging research – an abstraction that can only be justified in software terms does not belong here. Nothing in this package knows about YAML, output directories, run modes, CLI, or logging.
User guide: Data model (habit.contracts) · Habitat Guide Load from directory. Adapters that load these objects from disk: Adapters (habit.adapters).
Contracts are plain value objects with no IO and no YAML knowledge.
Classes
Imaging
Spatial definition shared by every volumetric object of one subject. |
|
Lazy handle to volumetric data. |
|
In-memory |
|
An image array with explicit physical-space metadata. |
|
An image-space segmentation mask with explicit label semantics. |
|
One imaging subject. |
|
Ordered collection of subjects. |
|
Non-identifiable description of the cohort behind a fitted model. |
Provenance
Immutable record answering "how was this object produced?". |
|
Everything needed to describe and audit one completed analysis. |
|
One observed pipeline boundary for one subject. |
|
Optional sink for |
Habitat artefacts
Per-voxel feature vectors inside one subject's ROI. |
|
Within-subject partition of the ROI into supervoxels, plus their features. |
|
Habitat label image for one subject. |
|
Population-level habitat definition -- HABIT's primary scientific artefact. |
Tables and outcomes
Feature table with explicit column semantics. |
|
A declared study endpoint. |
|
Two-class endpoint, e.g. treatment response or 2-year recurrence. |
|
Endpoint with three or more mutually exclusive classes. |
|
Continuous endpoint for regression, e.g. tumour volume change or a score. |
|
Right-censored time-to-event endpoint, e.g. overall or progression-free survival. |
Operator protocols
A computation that touches exactly one subject. |
|
A computation that must observe the whole cohort at once. |
|
Result slot for one subject, distinguishing success from isolated failure. |
|
Strategy for executing subject-level work. |
|
Anything that can produce a cohort. |
|
Anything that can persist HABIT outputs. |
Functions
Build a cohort from HABIT's conventional directory layout. |
|
Capture HABIT and scientifically relevant dependency versions. |
|
Rebuild an endpoint declaration from its serialised mapping. |
|
Serialise an endpoint declaration to a plain mapping for YAML/JSON. |