Local Diffusion ALPS (LD-ALPS)
This page last updated 2025/09/09
Introduction
This provides a refactored, public‑facing implementation of the Local Diffusion Analysis Along the Perivascular Space (LD‑ALPS) post‑processing pipeline. It computes LD‑ALPS and related ALPS indices for each subject directory, with a robust command‑line interface, logging, and CSV export.
Motivation
ALPS indices are routinely used as an imaging proxy for perivascular (glymphatic) fluid dynamics, but the conventional “unrotated” computation is highly sensitive to head orientation during MRI acquisition. The accompanying manuscript shows that head pitch systematically biases unrotated ALPS, that vector‑registered ALPS reduces this bias, and proposes LD‑ALPS to further mitigate orientation dependence by using voxelwise local orthogonal diffusion directions within each ROI. In that study, LD‑ALPS displayed no association with head pitch and showed the strongest relation to MMSE (retaining significance after conditioning on mean diffusivity). [Citation forthcoming]
Installation
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install --upgrade pip
pip install numpy scipy scikit-learn nibabel
Download
Download the code here, and the original code used to produce the data in the manuscript here.
Expected inputs
For each subject directory (default prefix alps_) the following files are required:
- eddy_corrected_data.nii.gz– 4D DWI after eddy correction
- dti_V1.nii.gz – primary diffusion direction volume (…, 3)
- nativeALPSrois.nii.gz – integer ROI labels (1: R_Assoc, 2: R_Proj, 3: L_Assoc, 4: L_Proj)
- eddy_corrected_data.eddy_rotated_bvecs or dwi.bvec
- bvals (also accepts bval or bval1)
Usage
Python new_alps_postprocessor_refactored.py /path/to/base_dir \
--subject-prefix alps_ \
--bvecs-rotated # use eddy-rotated bvecs (default) \
--no-bvecs-rotated # use original bvecs instead \
--eps 0.5 # DBSCAN eps (radians) for V1 clustering \
--min-samples 5 # DBSCAN min_samples \
-o ld_alps_metrics.csv # output CSV
Example:
python new_alps_postprocessor_refactored.py /data/ADNI_niis -vv -o results.csv
Output CSV columns
Column | Description |
---|---|
subject | Subject directory name |
ALPS_overall | Mean of left and right ALPS |
L_ALPS , R_ALPS | Hemispheric ALPS indices |
{L,R}_{Association,Projection}_{x,i} | Mean ADCs per ROI for axes X (glymphatic) and I (non‑glymphatic) |
Method notes
- ADC computation: vectorized with numerical guards:
ADC = (-1/b) * ln(sDWI / S0)
. - ROI cleaning: DBSCAN over great‑circle distances on the sphere; we keep the largest cluster and remove noise/outliers.
- Local axes: for each voxel, form an orthonormal triad from its V1 and the partner‑ROI medoid; X = V1 × partner, I = V1 × X.
- Interpolation: b‑vectors are orthographically projected onto the tangent plane about the target axis. We deduplicate near‑identical samples and interpolate at the origin using Clough‑Tocher (C1), with graceful fallback to linear/nearest.
- Guards: any negative interpolated ADC is clipped to 0 to avoid artifacts from sparse/degenerate sampling.
Reproducibility & diagnostics
The CLI logs progress per subject and writes a CSV for downstream statistics. If you need QC plots or histograms,
extend compute_ld_alps_for_subject
to persist figures for proj_x/proj_i distributions.
Citing
Manuscript currently under review.
License
MIT