Skip to content

📝 Add a theory note on phase offset ambiguities - #33

Merged
vanandrew merged 2 commits into
mainfrom
docs/phase-offset-note
Jul 28, 2026
Merged

📝 Add a theory note on phase offset ambiguities#33
vanandrew merged 2 commits into
mainfrom
docs/phase-offset-note

Conversation

@vanandrew

Copy link
Copy Markdown
Owner

Adds a standalone theory note (notes/phase-offset-ambiguities.typ, with the
compiled PDF) covering the phase-offset ambiguity in multi-echo field mapping:
why the MCPC-3D-S offset estimate leaves one integer undetermined, why ROMEO's
global correction tips on individual frames for subjects whose field sits near
the half-wrap, and the intercept-based procedure that detects and repairs it.

Contents

  • The signal model, the candidate ladder, and a proof (Prop. 1) that for evenly
    spaced echoes every candidate predicts identical recorded phase — so no
    statistic over the phase can rank them and a prior is unavoidable.
  • Why the per-frame median ballot fails near the half-wrap, and Prop. 2, the
    intercept signature that a mismatched offset/field pair leaves behind.
  • The selection algorithm, first as prose and then as a specification, plus what
    the estimator of the global field has to be robust against.
  • An appendix with the proof and a drawn figure of the candidate pencil.

Notes for reviewers

  • The note is written to be implementation-independent, so it can be handed
    to a license-friendly reimplementation. Section 8.1 states what the unwrapper,
    the two masks, and the weighted median must provide — as properties, not as
    settings — rather than transcribing any particular implementation. There are
    deliberately no unwrapper flags, mask recipes, or references to this repo's
    test fixtures.
  • Reference data is public: ds006131 v2.0.1. The dataset name, version, subject
    count, echo times (5 echoes, TE0 = 14.2 ms, uniform 24.73 ms spacing) and
    243-frame length were checked against OpenNeuro; the uniform spacing matters
    because Prop. 1 depends on it.
  • Derived quantities were checked against the implementation: delta = 2.68 rad,
    half-wrap 20.22 Hz, wrap 40.44 Hz, k = 0.574.
  • Section 8's scope is the phase offset only. Downstream field-map
    reconstruction is out of scope and not described.

CI

Docs only — no Python or C++ changes, so nothing touching the wheel matrix,
pybind11 ABI, or ITK. The PDF is committed next to the source; rebuild with
typst compile notes/phase-offset-ambiguities.typ.

Derives what the unknown turn count left by spatial unwrapping does to the
MCPC-3D-S offset estimate, why resolving it per frame is unstable when the
bulk field approaches the half-wrap, and how a mismatched offset/field pair
becomes detectable. Documents the two-stage selector MEDIC uses and the
requirements on the field estimator.

Theory only; no measured results.
- Replace the appendix's "plot phase against echo time" prose with a drawn
  figure of the candidate pencil, and state the pivot at TE0 as a consequence
  of the proof rather than something the reader must picture.
- Add section 8.1 giving what the unwrapper, the two masks, and the weighted
  median must provide, as properties rather than settings, so the spec is
  self-contained without describing any particular implementation.
- Correct the delta = 0 guard: an exact float comparison never fires, so
  specify a tolerance test.
- Drop the even-sized-median qualification, which was opaque and whose closing
  claim about the detector was wrong (for k near 0.58-0.74 it accepts a single
  wrong candidate rather than rejecting all of them).
- Remove the test-fixture reference and its two mistranscribed voxel counts so
  the note stands on its own.
- Add a units statement, sharpen the second unwrap's description, condense the
  recap that restated sections 6 and 7, and shorten the reference-data block.
- Layout: let the appendix flow instead of forcing a pagebreak, and keep the
  reference-data box unbreakable; 11 pages down to 10.
Copilot AI review requested due to automatic review settings July 28, 2026 18:42
@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.25%. Comparing base (f462497) to head (d94ad0b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #33   +/-   ##
=======================================
  Coverage   96.25%   96.25%           
=======================================
  Files          18       18           
  Lines        1280     1280           
=======================================
  Hits         1232     1232           
  Misses         48       48           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a standalone Typst theory note to the notes/ area documenting (at an implementation-agnostic level) the integer ambiguity in phase-offset estimation for evenly spaced multi-echo field mapping, why ROMEO’s per-frame “smallest-field” choice can tip near the half-wrap, and the intercept-based procedure used to detect/repair tipped frames.

Changes:

  • Introduces a new Typst note describing the signal model, candidate ladder ambiguity (Prop. 1), and failure mode near the half-wrap.
  • Specifies the intercept-based detection/selection algorithm (Prop. 2) and the required properties of the unwrapper/masks/weighted median.
  • Commits the compiled PDF alongside the Typst source.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
notes/phase-offset-ambiguities.typ New Typst source for the phase-offset ambiguity theory note, including propositions and an algorithm/spec section.
notes/phase-offset-ambiguities.pdf Compiled PDF output of the note committed alongside the source.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vanandrew
vanandrew merged commit 827a8ba into main Jul 28, 2026
25 checks passed
@vanandrew
vanandrew deleted the docs/phase-offset-note branch July 28, 2026 18:50
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.

2 participants