Skip to content

fix(3d-ngldm): DCNU/DCNUN summed the wrong marginal (== GLNU) - #387

Open
darkclad wants to merge 1 commit into
PolusAI:mainfrom
darkclad:main-ngldm-dcnu-fix
Open

fix(3d-ngldm): DCNU/DCNUN summed the wrong marginal (== GLNU)#387
darkclad wants to merge 1 commit into
PolusAI:mainfrom
darkclad:main-ngldm-dcnu-fix

Conversation

@darkclad

Copy link
Copy Markdown

3D NGLDM Dependence Count Non-Uniformity computed the GREY-LEVEL (row) marginal s_{i.} = sum_j s_ij -- the outer loop iterated grey level i and summed over j, byte-identical to the GLNU loop directly above it. So 3NGLDM_DCNU == 3NGLDM_GLNU and 3NGLDM_DCNUN == 3NGLDM_GLNUN for every ROI, which is wrong: DCNU is the DEPENDENCE-COUNT (column) marginal s_{.j} = sum_i s_ij, then sum_j s_{.j}^2.

Transpose the loops (outer over dependence-count columns j, inner sum over grey levels i), matching the row-marginal's j in [1,Nr) convention. The 2D twin ngldm.cpp was already correct (it builds separate Sg/Sr marginal arrays).

On the 3D coverage phantom (ut_inten.nii label 57, GREYDEPTH=64): DCNU 115443.18 -> 85056.84, DCNUN 0.22575716 -> 0.16633456; GLNU/GLNUN unchanged, confirming the fix is isolated to DCNU. Updated the two pinned snapshots (test_3d_coverage_common.h, test_3d_ngldm_ibsi.h) to the corrected values. Full gtest suite 706/706.

NOTE: the corrected DCNU (85056.84) still does not match an independent MIRP run (40745) -- that is a separate NGLDM matrix-construction / binning divergence from IBSI, tracked as regression on branch main-ngldm; this commit only fixes the transposed-marginal bug and is not an oracle-agreement claim.

3D NGLDM Dependence Count Non-Uniformity computed the GREY-LEVEL (row) marginal
s_{i.} = sum_j s_ij -- the outer loop iterated grey level i and summed over j,
byte-identical to the GLNU loop directly above it. So 3NGLDM_DCNU == 3NGLDM_GLNU
and 3NGLDM_DCNUN == 3NGLDM_GLNUN for every ROI, which is wrong: DCNU is the
DEPENDENCE-COUNT (column) marginal s_{.j} = sum_i s_ij, then sum_j s_{.j}^2.

Transpose the loops (outer over dependence-count columns j, inner sum over grey
levels i), matching the row-marginal's j in [1,Nr) convention. The 2D twin
ngldm.cpp was already correct (it builds separate Sg/Sr marginal arrays).

On the 3D coverage phantom (ut_inten.nii label 57, GREYDEPTH=64): DCNU
115443.18 -> 85056.84, DCNUN 0.22575716 -> 0.16633456; GLNU/GLNUN unchanged,
confirming the fix is isolated to DCNU. Updated the two pinned snapshots
(test_3d_coverage_common.h, test_3d_ngldm_ibsi.h) to the corrected values.
Full gtest suite 706/706.

NOTE: the corrected DCNU (85056.84) still does not match an independent MIRP run
(40745) -- that is a separate NGLDM matrix-construction / binning divergence from
IBSI, tracked as regression on branch main-ngldm; this commit only fixes the
transposed-marginal bug and is not an oracle-agreement claim.
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