fix(3d-ngldm): DCNU/DCNUN summed the wrong marginal (== GLNU) - #387
Open
darkclad wants to merge 1 commit into
Open
fix(3d-ngldm): DCNU/DCNUN summed the wrong marginal (== GLNU)#387darkclad wants to merge 1 commit into
darkclad wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.