fix(gldm): exclude background from the dependence matrix#354
Open
darkclad wants to merge 4 commits into
Open
Conversation
The MATLAB grey-binning path maps off-ROI background (0) to level 1, so the GLDM zone loop's `pi == 0` guard (which tests the BINNED value) never rejected background pixels inside the bounding box. They were counted both as zones and as dependent neighbours, inflating Nz (154 -> 234 on the canonical ROI) and every count/dependence feature. Skip background by the ORIGINAL intensity (imR / raw cloud value == 0) and require a neighbour to be an ROI pixel before counting it as a dependency, in both the trivial and out-of-core paths. Mirrors the GLCM background fix. Adds tests/python/test_feature_bugs.py::test_gldm_background_not_counted, checking LDE/GLN/DN against the PyRadiomics reference on the canonical ROI.
sameeul
reviewed
Jul 1, 2026
Comment on lines
+1
to
+5
| """Regression / bug-exposure tests for 2D feature defects found during oracle validation | ||
| (2026-06). These exercise the PRODUCTION featurize() path on ROIs *with background* and at | ||
| the DEFAULT settings - the conditions the C++ unit tests miss. | ||
|
|
||
| This module covers the GLDM background-pollution defect (bug #14b). |
Member
There was a problem hiding this comment.
this comment and the file name need to be updated to reflect the test. Saying it test_feature_bugs.py will become misleading in the long run. Also, do we have an equivalent GTest?
added 3 commits
July 1, 2026 11:49
…guard Address PR PolusAI#354 review: the generic test_feature_bugs.py name/comment would become misleading, and there was no C++ equivalent. - Rename tests/python/test_feature_bugs.py -> test_gldm_bugs.py and scope the docstring to the GLDM background-pollution defect (bug #14b). - Add tests/test_gldm_bugs.h::test_gldm_bug_background_excluded, a GTest on a concave 3x3-ring ROI whose bounding box contains a background hole - the condition the fully-masked test_gldm.h phantoms cannot reproduce. Asserts the exact hand-computed GLDM matrix (Nz=8, GLN=8, DN=4, DNN=0.5, LDE=17); the pre-fix background pollution gave GLN 7.22 / DN 3.67 / LDE 15.22. - Register the new test in test_all.cc.
Drop the _bugs suffix from the GLDM regression guards, renaming
test_gldm_bugs.{h,py} -> test_gldm_oracle.{h,py} to reflect their
origin in the PyRadiomics oracle-validation effort. Updates the
test_all.cc include and the cross-reference comments in both files.
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.
The MATLAB grey-binning path maps off-ROI background (0) to level 1, so the GLDM zone loop's
pi == 0guard (which tests the BINNED value) never rejected background pixels inside the bounding box. They were counted both as zones and as dependent neighbours, inflating Nz (154 -> 234 on the canonical ROI) and every count/dependence feature.Skip background by the ORIGINAL intensity (imR / raw cloud value == 0) and require a neighbour to be an ROI pixel before counting it as a dependency, in both the trivial and out-of-core paths. Mirrors the GLCM background fix.
Adds tests/python/test_feature_bugs.py::test_gldm_background_not_counted, checking LDE/GLN/DN against the PyRadiomics reference on the canonical ROI.