Skip to content

test(morphology): vet DIAMETER_EQUAL_PERIMETER + ORIENTATION + EROSIONS_2_VANISH -> 80/113 - #391

Open
darkclad wants to merge 1 commit into
PolusAI:mainfrom
darkclad:main-morphology-analytic
Open

test(morphology): vet DIAMETER_EQUAL_PERIMETER + ORIENTATION + EROSIONS_2_VANISH -> 80/113#391
darkclad wants to merge 1 commit into
PolusAI:mainfrom
darkclad:main-morphology-analytic

Conversation

@darkclad

Copy link
Copy Markdown

Vet three more 2D morphology features against analytic / scikit-image oracles (morphology 77 -> 80), and document why four others in the "future-vettable" list are not cleanly promotable.

Promoted:

  • DIAMETER_EQUAL_PERIMETER -> analytic. == PERIMETER/pi (contour.cpp), pure double arithmetic on the vetted PERIMETER; recomputed at 1e-9 in the existing documented-formula-conformance test (same treatment as CIRCULARITY/ROUNDNESS).
  • ORIENTATION -> skimage. skimage regionprops measures the major-axis angle from the row axis; Nyxus measures the same ellipse from the x axis, so NYXUS == 90 - degrees(skimage.orientation) = 70.4174. Matches to 10 decimals because the ellipse angle is invariant to the pixel-size second-moment correction (it shifts mu20 and mu02 equally). New gtest test_shape2d_skimage_orientation_and_erosions + tests/vetting/oracles/gen_morphology_skimage.py.
  • EROSIONS_2_VANISH -> skimage. Nyxus' 3x3 (8-connected) erosion count == skimage binary_erosion(square(3)) = 1; disk(1)/4-connected gives 2, so the test also pins the connectivity convention.

Documented (stay regression, with reasons in the registry notes):

  • GEODETIC_LENGTH: geo_len_thickness.cpp truncates PERIMETER to size_t and uses integer division, so its value (10.0) deviates ~11% from the real-valued rectangle formula (~11.13). Vetting it analytically would bake in the truncation -- a latent precision issue to fix first.
  • ROI_RADIUS_MEAN/MAX: mean/max per-pixel min SQUARED distance to the ROI's own contour pixels (roi_radius.cpp); scipy distance_transform_edt uses a different reference (distance to background, not squared), so no standard tool reproduces it.
  • EROSIONS_2_VANISH_COMPLEMENT: degenerate 0 on this fixture; needs a holed fixture.
  • MAJOR/MINOR_AXIS_LENGTH, ECCENTRICITY: ~1.4% moment-normalization gap vs skimage, left regression.

gtest 717/717; pytest 72 passed (7 arrow fails are the tiff-only local build, not regressions). Coverage regenerated (604 -> 607 / 758).

…NS_2_VANISH -> 80/113

Vet three more 2D morphology features against analytic / scikit-image oracles
(morphology 77 -> 80), and document why four others in the "future-vettable" list
are not cleanly promotable.

Promoted:
  - DIAMETER_EQUAL_PERIMETER -> analytic. == PERIMETER/pi (contour.cpp), pure double
    arithmetic on the vetted PERIMETER; recomputed at 1e-9 in the existing
    documented-formula-conformance test (same treatment as CIRCULARITY/ROUNDNESS).
  - ORIENTATION -> skimage. skimage regionprops measures the major-axis angle from the
    row axis; Nyxus measures the same ellipse from the x axis, so NYXUS ==
    90 - degrees(skimage.orientation) = 70.4174. Matches to 10 decimals because the
    ellipse angle is invariant to the pixel-size second-moment correction (it shifts
    mu20 and mu02 equally). New gtest test_shape2d_skimage_orientation_and_erosions +
    tests/vetting/oracles/gen_morphology_skimage.py.
  - EROSIONS_2_VANISH -> skimage. Nyxus' 3x3 (8-connected) erosion count ==
    skimage binary_erosion(square(3)) = 1; disk(1)/4-connected gives 2, so the test
    also pins the connectivity convention.

Documented (stay regression, with reasons in the registry notes):
  - GEODETIC_LENGTH: geo_len_thickness.cpp truncates PERIMETER to size_t and uses
    integer division, so its value (10.0) deviates ~11% from the real-valued rectangle
    formula (~11.13). Vetting it analytically would bake in the truncation -- a latent
    precision issue to fix first.
  - ROI_RADIUS_MEAN/MAX: mean/max per-pixel min SQUARED distance to the ROI's own
    contour pixels (roi_radius.cpp); scipy distance_transform_edt uses a different
    reference (distance to background, not squared), so no standard tool reproduces it.
  - EROSIONS_2_VANISH_COMPLEMENT: degenerate 0 on this fixture; needs a holed fixture.
  - MAJOR/MINOR_AXIS_LENGTH, ECCENTRICITY: ~1.4% moment-normalization gap vs skimage,
    left regression.

gtest 717/717; pytest 72 passed (7 arrow fails are the tiff-only local build, not
regressions). Coverage regenerated (604 -> 607 / 758).
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