Skip to content

Honour VisuGroupDepVals valsStart when two frame groups share an array - #208

Merged
headmeister merged 2 commits into
isi-nmr:masterfrom
gdevenyi:fix/frame-group-vals-start
Aug 10, 2026
Merged

Honour VisuGroupDepVals valsStart when two frame groups share an array#208
headmeister merged 2 commits into
isi-nmr:masterfrom
gdevenyi:fix/frame-group-vals-start

Conversation

@gdevenyi

@gdevenyi gdevenyi commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Fixes #200.

Spec 7.4:

typedef struct {
    char name[VISU_MAX_NAME_LEN];  // Name of dependent parameter (must be an array)
    int valsStart;                  // Start index in the dependent parameter array
} VISU_DEPVALS_TYPE;

frame_group_values read only name and never valsStart. When two groups depend on the same parameter the writer concatenates their blocks and gives each group its own start; recording both axes under one name made the code spread the concatenation over the product of the two axis lengths, which never matched, so the parameter was dropped.

Before / after

resources/testdata/bruker2nifti_qa/raw/Cyceron_DWI/.../3/pdata/2FG_DTI (len 22, valsStart 3), FG_CYCLE (len 3, valsStart 0), 25 comments:

before:  VisuCoreDataUnits, VisuFGElemId, VisuCoreOrientation, VisuCorePosition
         (VisuFGElemComment missing -- 25 % (22*3) != 0)

after:   ... plus
         VisuFGElemComment[FG_DTI]    (1,1,22,1,1)  'Fractional Anisotropy', 'Trace', 'Intensity', ...
         VisuFGElemComment[FG_CYCLE]  (1,1,1,1,3)   'R 1', 'R 2', 'R 3'

Change

Each (group, dependency) pair gets its own window parameter[valsStart : valsStart + group_len]. A parameter owned by one group keeps its plain name, so nothing that worked before changes; a shared one is keyed name[GROUP_ID], which is the only way a single mapping can express two windows. The alignment logic moved into _align_to_frame_groups unchanged.

Across 514 corpus reconstructions the result changes for exactly three — Cyceron_DWI/3/pdata/1, 3/pdata/2 and pv5/0.2H2/31/pdata/2 — and every change is an addition; nothing was removed or altered.

Tests

  • test_two_frame_groups_can_share_one_dependent_parameter — a synthetic two-group reconstruction whose VisuFGElemComment is shared with different starts. Fails on master with KeyError.
  • test_a_parameter_owned_by_one_frame_group_keeps_its_plain_name — guards the unchanged single-group key.

Suite: 2142 passed, 12 skipped.

gdevenyi and others added 2 commits August 8, 2026 16:33
`ruff format --check` reported twelve files as unformatted, so any change
touching one of them dragged unrelated reflow into its diff. Run the
formatter once, on its own, so subsequent changes show only what they
actually change.

Formatting only: no behaviour changes, and `ruff check` is clean before and
after. The suite is unchanged at 2140 passed, 12 skipped.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017SNrm3jFhpTPShP8xGkePC
frame_group_values read only the name element of each VisuGroupDepVals
entry and never element [1], which spec 7.4 defines as
VISU_DEPVALS_TYPE.valsStart -- the offset at which that frame group's block
begins inside the dependent parameter's array.

When two groups declare a dependency on the same parameter the writer
concatenates their blocks and gives each group its own valsStart. Recording
both axes under the one name made the code spread the concatenated array
over the product of both axis lengths; the product never matched, and the
parameter was dropped from the result entirely.

On the Cyceron DWI PROCNOs that silently lost VisuFGElemComment -- the per-map
names (Fractional Anisotropy, Trace, the tensor components, the eigenvalue
and eigenvector maps) that are the only thing saying which of the 22 volumes
is which. Spec 7.4 points at VisuFGElemComment as exactly where those labels
live.

Give each (group, dependency) pair its own window. A parameter owned by one
group keeps its plain name, so nothing that worked before changes; a shared
one is keyed per group, which is the only way a single mapping can express
two windows. Across 514 corpus reconstructions the result changes for
exactly three, all of them gaining the labels they used to lose.

Closes isi-nmr#200

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017SNrm3jFhpTPShP8xGkePC
@gdevenyi
gdevenyi force-pushed the fix/frame-group-vals-start branch from b3198df to a56454e Compare August 8, 2026 20:51
@gdevenyi

gdevenyi commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto #213 (ruff format), so this branch carries that commit until #213 merges — merge #213 first and this diff reduces to its own change. Verified after the rebase: ruff check and ruff format --check clean, full suite green.

Integration check across all eleven conformance PRs merged together: 2164 passed, 12 skipped; corpus load test 3202 → 3207 of 3478 with zero newly broken datasets.

@headmeister
headmeister merged commit ad1eae4 into isi-nmr:master Aug 10, 2026
7 checks passed
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.

frame_group_values ignores VisuGroupDepVals valsStart, so VisuFGElemComment labels shared between two frame groups are silently dropped (spec 7.4)

2 participants