Skip to content

test(glcm,convex-hull): precise vetted-comment wording; pin convex-hull oracle to offset_coordinates=False#364

Open
sameeul wants to merge 1 commit into
PolusAI:mainfrom
sameeul:followup/glcm-comments-convexhull-offset-false
Open

test(glcm,convex-hull): precise vetted-comment wording; pin convex-hull oracle to offset_coordinates=False#364
sameeul wants to merge 1 commit into
PolusAI:mainfrom
sameeul:followup/glcm-comments-convexhull-offset-false

Conversation

@sameeul

@sameeul sameeul commented Jul 10, 2026

Copy link
Copy Markdown
Member

Follow-up to the reviews on #356 and #357 (both merged). Test-only.

#356 comment precision (tests/test_glcm.h)

Two wording corrections in the vetted-map comment, no value changes:

  • SUMENTROPY was grouped as "depends only on the grey-level DIFFERENCE |i−j|". It doesn't — it's the dimensionless entropy of the SUM distribution p_{x+y}. It's still correctly vetted (a dimensionless entropy is level-value-invariant), but the stated reason didn't apply to it.
  • "invariant to the absolute level values that matlab binning re-maps" overstated it. Difference-based features are invariant to a level relabeling / origin shift, not to level scaling — they coincide with the symmetric-matrix oracle only because this phantom's binning relabels without rescaling. Clarified, with the scaling caveat called out.

#357 tighter convex-hull oracle (tests/test_shape_morphology_2d.h)

The merged test vets CONVEX_HULL_AREA / SOLIDITY against skimage regionprops' default (28 / 0.9286) at a 10% tolerance. Since Nyxus hulls through pixel centres, it reproduces skimage convex_hull_image(offset_coordinates=False) == 27 exactly (SOLIDITY 26/27). This PR pins to that convention and tightens the tolerance 10% → 1% (frac_tolerance 10 → 100).

Rationale: the hull area is a provably-exact integer lattice count, so 1% is float/platform slack rather than a convention fudge, and the check now catches a ≥1 px regression (the old 10% band accepted ±2.8 px). The +1 px regionprops-default (offset_coordinates=True corner expansion → 28) is documented in the comment as the reason we pin the offset_coordinates=False value instead.

The new goldens equal Nyxus's actual output for these fixtures (they were the pre-#357 regression-snapshot values), so no runtime behavior changes and both C++ tests pass unchanged.

…ll oracle to skimage offset_coordinates=False

Follow-up to the PR PolusAI#356 / PolusAI#357 reviews (both merged).

test_glcm.h (PolusAI#356 follow-up): correct the vetted-map comment, no value changes.
SUMENTROPY is the dimensionless entropy of the SUM distribution p_{x+y}, not a
difference-based feature; and the vetted keys are invariant to a level
RELABELING (origin shift), not to level scaling -- they coincide with the
symmetric-matrix oracle only because this phantom's binning relabels without
rescaling.

test_shape_morphology_2d.h (PolusAI#357 follow-up): vet CONVEX_HULL_AREA / SOLIDITY
against skimage convex_hull_image(offset_coordinates=False) (27 / 0.9629630),
which Nyxus's pixel-centre hull reproduces exactly, instead of the regionprops
default (28 / 0.9286). Tighten the tolerance 10% -> 1% (frac_tolerance 10 ->
100); the hull area is a provably-exact integer lattice count, so 1% is float
slack and now catches a >=1 px regression.

Test-only; the new goldens equal Nyxus's actual output for these fixtures.
@sameeul sameeul requested a review from darkclad July 11, 2026 08:55
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.

2 participants