Skip to content

Reject negative ADC labels and default raw recon to custom#765

Merged
cncastillo merged 7 commits into
masterfrom
codex/validate-negative-labels
May 22, 2026
Merged

Reject negative ADC labels and default raw recon to custom#765
cncastillo merged 7 commits into
masterfrom
codex/validate-negative-labels

Conversation

@cncastillo
Copy link
Copy Markdown
Member

@cncastillo cncastillo commented May 2, 2026

Problem

Negative ADC labels fail late during raw-data conversion because ISMRMRD encoding counters are unsigned. For long simulations this means users only see the failure after simulation work has already completed.

The raw-data header also used other as the default trajectory label, while KomaMRI-generated raw data should use custom for reconstruction.

Solution

  • Checks cumulative ADC labels with get_labels(seq) at the start of simulate and stops on the first negative value.
  • Changes the raw-data trajectory default from other to custom.
  • Updates the label tutorial to start from the default zero counter instead of using a negative LabelSet hack.

Tests

  • Pkg.test("KomaMRICore")

Development

Closes #637
Context: discussion #786

@codecov
Copy link
Copy Markdown

codecov Bot commented May 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.57%. Comparing base (230fbad) to head (25233f3).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #765      +/-   ##
==========================================
- Coverage   89.82%   88.57%   -1.26%     
==========================================
  Files          76       76              
  Lines        5398     5399       +1     
==========================================
- Hits         4849     4782      -67     
- Misses        549      617      +68     
Flag Coverage Δ
base 86.47% <ø> (ø)
core 79.76% <100.00%> (-9.89%) ⬇️
files 95.26% <ø> (ø)
komamri 88.32% <ø> (ø)
plots 90.88% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
KomaMRICore/src/rawdata/ISMRMRD.jl 98.59% <ø> (+1.36%) ⬆️
KomaMRICore/src/simulation/SimulatorCore.jl 90.28% <100.00%> (-0.42%) ⬇️

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cncastillo
Copy link
Copy Markdown
Member Author

CI failed in the docs build because examples/3.tutorials/lit-07-label.jl used the old LabelSet(-1, "LIN") offset trick before simulation. This branch now assigns explicit zero-based nonnegative LIN values on ADC blocks, so the validation remains strict and the tutorial still feeds MRIReco zero-based lines.

Verified locally with julia --project=docs docs/make.jl.

@cncastillo
Copy link
Copy Markdown
Member Author

Follow-up: the tutorial now uses the intended LabelInc form instead of explicit LabelSet values. Label counters already start at 0; the increment is attached to the block after each ADC, so ADC profiles read 0, 1, 2, ... without ever creating a negative label state.

Verified with julia --project=docs docs/make.jl.

@cncastillo cncastillo changed the title Reject negative sequence labels before simulation Reject negative labels before sim + allowing random order recon May 20, 2026
@cncastillo cncastillo changed the title Reject negative labels before sim + allowing random order recon Reject negative ADC labels and default raw recon to custom May 20, 2026
@cncastillo cncastillo merged commit eae656a into master May 22, 2026
20 checks passed
@cncastillo cncastillo deleted the codex/validate-negative-labels branch May 22, 2026 21:24
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.

Catch negative labels in sequences

1 participant