brain_deer.utils.fa_dec

FA (Fractional Anisotropy) and direction-encoded color (DEC) utilities for DTI visualization.

Direction-encoded color maps fiber orientation using the principal eigenvector (V1): - Red: left-right (x) - Green: anterior-posterior (y) - Blue: superior-inferior (z)

Standard formula: RGB = abs(V1) * FA (absolute eigenvector components weighted by FA for brightness)

Functions

compute_fa_dec(→ tuple[nibabel.Nifti1Image, bool])

Compute direction-encoded color (DEC) FA map.

Module Contents

brain_deer.utils.fa_dec.compute_fa_dec(fa_path: str, v1_path: str | None = None, fa_image: nibabel.Nifti1Image | None = None) → tuple[nibabel.Nifti1Image, bool]

Compute direction-encoded color (DEC) FA map.

Uses fa_image if provided (RAS-reoriented); DEC is computed in raw space then reoriented to match. If fa_image is None, loads from fa_path. If v1_path is None, searches for V1 alongside the FA file. Returns (nifti_image, is_dec) where is_dec is True if DEC was computed.