preprocess_subject

Note

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

preprocess_subject(subject: Subject, steps: Mapping[str, Mapping[str, Any]], *, mask_roi: str | None = None, broadcast_mask: bool = True) → Subject[source]

Apply an ordered image-preprocessing chain to one subject in memory.

Recipe twin of habit.recipes.preprocess_workflow.preprocess_subject(). See that function for full argument documentation.

Parameters:
  • subject – One imaging subject.

  • steps – Ordered {step_name: params} mapping (YAML preprocessing block shape).

  • mask_roi – Optional ROI key; auto-selected when the subject has exactly one mask.

  • broadcast_mask – Attach the ROI under every mask_<modality>.

Returns:

A new Subject with processed in-memory volumes.