brain_deer.warp.apply¶
Headless orchestration of applying a refinement session to a normalization.
This is the pure, importable core behind the warpdrive_apply_corrections
command: read a session’s control points, solve the correction field on a coarse
grid over the forward warp, and compose it into corrected forward/inverse warps.
It lives in brain_deer.warp (not brain_deer.commands) so external
hosts – notably Lead-Lizard – can drive the exact same orchestration without
pulling in the command registry. It raises WarpApplyError; the command
wrapper translates that into the registry’s CommandError.
Exceptions¶
A refinement-apply orchestration failure (bad inputs, empty session). |
Functions¶
|
Apply a WarpDrive session's corrections to a pair of ANTs warps. |
|
Bake corrections into the subject's warps and harden the session points. |
Module Contents¶
- exception brain_deer.warp.apply.WarpApplyError¶
Bases:
ValueErrorA refinement-apply orchestration failure (bad inputs, empty session).
- brain_deer.warp.apply.apply_corrections(session_dir: str, forward_warp: str, inverse_warp: str, out_dir: str, *, spacing: float = 2.0, stiffness: float = 0.1) dict¶
Apply a WarpDrive session’s corrections to a pair of ANTs warps.
Reads
source.json/target.jsonfromsession_dir, solves the correction on a coarse grid overforward_warp, and writes corrected forward and inverse warps intoout_dir(never overwriting the inputs).
- brain_deer.warp.apply.harden_corrections(session_dir: str, forward_warp: str, inverse_warp: str, *, spacing: float = 2.0, stiffness: float = 0.1, backup: bool = True) dict¶
Bake corrections into the subject’s warps and harden the session points.
Unlike
apply_corrections(), this overwritesforward_warp/inverse_warp(optionally keeping*.bakcopies) and rewrites the session’ssource.json/target.jsonso every point becomes a fixed anchor (source == target). Reload then holds anatomy in place rather than re-applying the same moves.