Repository navigation
Conversation
A GLSZM zone is 8-connected, as IBSI, PyRadiomics and MIRP define it. The 2D zone walk stepped only east, south-east, south and south-west from a pixel already in the zone, so a zone that turned back west or north was split into several smaller zones and every 2D GLSZM feature moved. On the 5 x 5 example of the PyRadiomics GLSZM documentation it found 13 zones where PyRadiomics finds 11. The walk now steps to all eight neighbours. The out-of-core path calls the same calculate(), and 3D GLSZM was already 26-connected. test_2d_glszm_pyradiomics.h checks all sixteen features against PyRadiomics 3.0.1 on four fixtures: three whose zones turn back west, north or north-east (they fail on the old walk) and a negative one whose same-level pixels touch only across a gap or through a pixel outside the mask, which must stay separate zones. gen_glszm_pyradiomics.py regenerates and re-verifies the pins. Docs: the GLSZM page describes 8-connectivity, drops the split-zone known issue, and its background-as-grey-level-1 example quotes the recomputed values (one of its zones was split as well). Conventions, validation, the 3D GLSZM page and the feature list follow.
vjaganat90
approved these changes
Nov 18, 2026
vjaganat90
left a comment
Member
There was a problem hiding this comment.
LGTM. I built the head and its base and compared 2D GLSZM in IBSI mode with PyRadiomics 3.0.1 (binWidth 1, force2D) on 8 random L-shaped ROIs of 3 to 8 levels: the head matches all 128 values (ZE within 4e-3), the base none. 3D GLSZM gives exactly the base values.
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.
Summary
A GLSZM zone is 8-connected, as IBSI, PyRadiomics and MIRP define it. The 2D zone walk in
GLSZMFeature::calculatestepped only east, south-east, south and south-west from a pixel already in the zone. A zone that turned back west, north-west, north or north-east was split into several smaller zones, and every 2D GLSZM feature changed.Nazanin Donyapour found this while comparing Nyxus with PyRadiomics on her datasets.
On the 5 x 5 example of the PyRadiomics GLSZM documentation, Nyxus found 13 zones where PyRadiomics finds 11:
GLSZM_ZPGLSZM_SAEThe walk now steps to all eight neighbours.
calculate().Why the existing oracle tests passed
The 2D GLSZM MIRP and IBSI tests run on the IBSI digital phantom. None of its zones turns back up or to the left, so the old walk and 8-connectivity find the same zones there. The docs listed the split as a known issue on the GLSZM page.
Tests
tests/test_2d_glszm_pyradiomics.hchecks all 16 features against PyRadiomics 3.0.1 (binWidth=1,force2D) on four fixtures, in IBSI mode. Fifteen features are checked to an absolute 1e-9.GLSZM_ZEis checked to a relative 4e-3 because of thefast_log10approximation.tests/vetting/oracles/gen_glszm_pyradiomics.pyregenerates and re-verifies every pin. It also fails if a positive fixture stops discriminating the old walk.Results:
pytest tests/python/: 346 passed.tests/python(327 passed), 0 sanitizer diagnostics.Docs