Skip to content

apps.buda: blip-up/blip-down EPI solved jointly; tools.displacement_off_resonance - #172

Draft
mcencini wants to merge 1 commit into
mainfrom
buda-1112
Draft

mcencini wants to merge 1 commit into
mainfrom
buda-1112

Conversation

@mcencini

Copy link
Copy Markdown
Collaborator

Draft for the 7 T EPI work (exam 5190). Adds two public functions:

  • apps.buda: blip-up/blip-down EPI solved jointly. Each shot is encoded by CartesianSense under FieldCorrected at its own sample times and, optionally, with its own low-resolution phase (apps.shot_phase). The solve uses the iteration pics would choose for the regularizers, after a data scaling taken from the adjoint image. This is not a BART command.
  • tools.displacement_off_resonance: turns a SusceptibilityCorrection's displacement (cell edges, voxel_size units) into Hz at the cell centres, f = -b / (n dt). The sign, centring and units are tested against an EPI pair encoded line by line through CartesianSense at a known field (test_the_off_resonance_of_a_corrected_epi_pair_is_the_one_that_displaced_it, needs PyHySCO).

Validation

Simulation: 8 coils, 128², Ry 2, 0.492 ms per line (series 31 timing), field up to 120 Hz. NRMSE against the truth, within the object:

Reconstruction NRMSE
SENSE of the blip-up shot, uncorrected 0.230
SENSE + HySCO, alpha 300 (pulserver's current default) 0.105
SENSE + HySCO, alpha 30 0.046
BUDA with the HySCO alpha 300 field (17 Hz RMS error) 0.201
BUDA with the HySCO alpha 30 field (5.9 Hz RMS error) 0.050
BUDA with the true field 0.011

So the joint model is right, and the field map limits it.

Scanner data, exam 5190 series 32 (192², Ry 2, PF 0.75, GRE maps, 6 virtual coils): BUDA does not work yet. The joint data residual is 0.67 to 0.72 for every field scale tried (0, 0.5, 1, -1 times the HySCO field). Single-shot SENSE residuals are 0.29 per set. The up/down data are therefore inconsistent beyond the field model, and single-shot SENSE with GRE maps already misfits. While doing this I found that the reference volume's k-space was placed 23 rows off. That is fixed in pypulseqpp #230 (27783f9eb), but it does not explain the residuals. Figures: build/scanner-2026-11-12/epi-fleet-buda/real_fixed_s32.png and sim_fleet_buda.png (local).

Do not wire BUDA into the pulserver EPI recon until a scan shows consistent up/down data.

Cost (one 192² slice, 6 coils, 2 shots, CPU, 8 threads; no CUDA device here)

  • CG l2, 30 iterations: 26 s.
  • With phase="estimate": 46 s.
  • Wavelet with phase estimation: 49 s.
  • Setting segments=8 with phase estimation: 34 s.
  • Peak process RSS rises from 0.9 GB (pulserver chain) to 2.8 GB.

Tests

tests/test_apps_buda.py (3) and tests/test_correct_susceptibility.py (13, including 2 new): 16 passed. test_namespace, test_docstrings, test_docs and test_apps together with those: 216 passed, 3 skipped. Ruff clean; codespell not run (not installed).

🤖 Generated with Claude Code

…ff_resonance

apps.buda stacks one CartesianSense under FieldCorrected per shot, each at its
own sample times and, optionally, its own low-resolution phase
(apps.shot_phase), and solves the joint data consistency with the iteration
pics would choose. tools.displacement_off_resonance turns a
SusceptibilityCorrection's edge-sampled displacement into Hz at the cell
centres, f = -b / (n dt); the sign, centring and units are tested against an
EPI pair encoded line by line at a known field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.85714% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/bartorch/apps/_buda.py 94.20% 4 Missing ⚠️
src/bartorch/tools/_correct/_susceptibility.py 83.33% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant