Skip to content

ENH: Hoist adjustValidNeighbors into NeighborUtilities - #1717

Open
imikejackson wants to merge 2 commits into
BlueQuartzSoftware:developfrom
imikejackson:refactor/adjust-valid-neighbors-hoist
Open

ENH: Hoist adjustValidNeighbors into NeighborUtilities#1717
imikejackson wants to merge 2 commits into
BlueQuartzSoftware:developfrom
imikejackson:refactor/adjust-valid-neighbors-hoist

Conversation

@imikejackson

Copy link
Copy Markdown
Contributor

Summary

De-duplicates the direction-flag gating helper used by the erode/dilate filter family.

  • adjustValidNeighbors existed as byte-identical file-local copies in the ErodeDilateBadData and ErodeDilateMask algorithms. Its axis-to-face mapping has been re-derived incorrectly once before (ErodeDilateBadDataFilter-D1 branch-history note), so a single canonical copy in NeighborUtilities.hpp removes the drift risk before a third family filter needs it.
  • No behavior change: the function body is character-identical, both call sites are unchanged, and the Mask direction-flag oracle tests pin the axis mapping empirically.
  • Historical line citations in the ErodeDilateBadData V&V documents refer to the pre-hoist file layout.

Stacked on #1713 — this branch contains the ErodeDilateMask V&V commit, so the diff shows both commits until #1713 merges. Merge after #1713; the hoist commit itself touches only three files (NeighborUtilities.hpp and the two algorithm .cpp files).

Test Plan

  • ctest -R "SimplnxCore::ErodeDilate" — 18/18 pass, including the three Mask direction-flag oracles that discriminate axis-mapping errors

@imikejackson
imikejackson requested a review from nyoungbq August 20, 2026 22:50
Summary:
- Found and fixed 2 bugs, both port omissions of behaviour DREAM3D 6.5.171 already had:
  (1) the X/Y/Z Direction parameters were declared, converted from SIMPL, and copied
  into InputValues but never read by Algorithms/ErodeDilateMask.cpp, so all six face
  neighbours were always visited (6.5.171 honoured them at ErodeDilateMask.cpp:227-247,
  making this a port regression with no deviation entry, same defect class as
  ErodeDilateBadDataFilter-D1 and fixed with that PR's adjustValidNeighbors pattern);
  (2) NumIterations <= 0 was accepted silently and no-op'd, where 6.5.171 rejected it in
  dataCheck with error -5555;
- resolved the 1 documented deviation from DREAM3D 6.5.171 (ErodeDilateMaskFilter-D1,
  NumIterations <= 0) by restoring the legacy guard per the requester's 2026-08-19
  product decision to match legacy — ErodeDilateMaskFilter::preflightImpl now errors with
  code -14701 (SIMPLNX code space, adjacent to the sibling ErodeDilateBadDataFilter's
  -146xx block; legacy's -5555 is already taken elsewhere in SIMPLNX) and a message
  carrying the offending value; no parameter keys change, so parametersVersion stays at 1
  and the deviation entry is kept with Status: retired as a record of the historical
  difference;
- added 1 negative test (Invalid Number of Iterations) written and confirmed failing
  before the guard existed, preflighting NumIterations of 0 and -2 and asserting an
  invalid result and error code -14701;
- retired 2 tests (the 6.6-derived exemplar consumers for Dilate and Erode — both
  exemplars were generated with all three directions on, so neither could discriminate
  direction gating and both passed with the regression present);
- unit tests replaced with 7 inlined *Class 1 (Analytical)* test fixtures, each expected
  index set hand-derived from the face-neighbour contract before the filter was run;
- added 2 V&V source-tree deliverables (report, deviations) — no provenance file, because
  no exemplar archive is consumed any more: the oracle is inlined in the test and the 6.6
  archive stays in test/CMakeLists.txt only for the sibling erode/dilate tests.

All 9 test cases pass (315 assertions) in NX-Com-Qt69-Vtk96-Rel. Status is READY FOR
REVIEW rather than COMPLETE: sign-off on the oracle design is delegated to the PR
reviewer (requester decision 2026-08-19). Out-of-core build runs were waived by the
requester on 2026-08-19.

Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
The direction-flag gating helper existed as byte-identical file-local
copies in the ErodeDilateBadData and ErodeDilateMask algorithms; its
axis-to-face mapping has been re-derived incorrectly once before
(ErodeDilateBadDataFilter-D1 branch-history note), so a single canonical
copy removes the drift risk before a third erode/dilate-family filter
needs it. No behavior change; the Mask direction-flag oracle tests pin
the mapping empirically. Historical line citations in the
ErodeDilateBadData V&V documents refer to the pre-hoist file layout.

Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
@imikejackson
imikejackson force-pushed the refactor/adjust-valid-neighbors-hoist branch from 8d2b080 to 81472d6 Compare August 24, 2026 14:13
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