Skip to content

BUG: Preserve point and cell data in CleanQuadEdgeMeshFilter - #6138

Merged
hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
hjmjohnson:issue-3453-clean-quadedge
Apr 27, 2026
Merged

BUG: Preserve point and cell data in CleanQuadEdgeMeshFilter#6138
hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
hjmjohnson:issue-3453-clean-quadedge

Conversation

@hjmjohnson

Copy link
Copy Markdown
Member

`itk::CleanQuadEdgeMeshFilter::MergePoints` never copied `PointData` or `CellData`, so any attributes attached to the input mesh were silently dropped. Fix copies both containers (point data before `SqueezePointsIds` runs so squeeze remaps them in lockstep; cell data via the new face's QE primal GetLeft()). Adds a regression test. Resolves #3453.

Root cause

MergePoints() in Modules/Filtering/QuadEdgeMeshFiltering/include/itkCleanQuadEdgeMeshFilter.hxx copied points, edge cells, and polygon cells from the decimator output to the filter output but did not propagate the corresponding PointData and CellData containers.

For point data: setting it on the output before CleanPoints() runs is sufficient — SqueezePointsIds() already migrates entries from the data container alongside the points it relocates.

For cell data: AddFaceWithSecurePointList() returns a QEPrimal*; the new face's identifier is newQE->GetLeft(). Capturing that lets us set the propagated cell data on the correct output cell ID.

The "cell point IDs are invalid post-clean" half of #3453 could not be reproduced. SqueezePointsIds walks the relocated point's QE ring and calls SetOrigin(newID) on every edge, and QuadEdgeMeshPolygonCell::MakePointIds() rebuilds the cached point-ID vector from the QE structure on every PointIdsBegin() call, so polygon cells reflect the post-squeeze IDs automatically. The new regression test asserts this and passes against pre-fix main.

Test plan

New test itkCleanQuadEdgeMeshFilterDataPreservationTest:

  • Builds a RegularSphereMeshSource (resolution 2 → 66 pts / 128 tris).
  • Attaches distinct per-point and per-cell data (pointID and 1000+cellID).
  • Runs the filter with RelativeTolerance=0.3 to force merges.
  • Verifies output point/cell counts decreased, output PointData/CellData size matches output point/cell count, and every polygon cell's point IDs reference an existing output point.

Pre-fix: prints Output : 65 points, 126 cells, 0 point-data entries, 0 cell-data entries → fails.
Post-fix: prints Output : 65 points, 126 cells, 65 point-data entries, 126 cell-data entries → passes.

The existing itkCleanQuadEdgeMeshFilterTest and the full ITKQuadEdgeMeshFiltering test label pass with no regressions on Apple Clang.

@github-actions github-actions Bot added type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct area:Filtering Issues affecting the Filtering module labels Apr 25, 2026
@hjmjohnson

Copy link
Copy Markdown
Member Author

@greptileai review this draft before I make it official

@greptile-apps

This comment was marked as resolved.

Comment thread Modules/Filtering/QuadEdgeMeshFiltering/include/itkCleanQuadEdgeMeshFilter.hxx Outdated
@hjmjohnson
hjmjohnson force-pushed the issue-3453-clean-quadedge branch from a7a5ba1 to e1e2713 Compare April 25, 2026 20:46
@hjmjohnson
hjmjohnson marked this pull request as ready for review April 25, 2026 20:49
itk::CleanQuadEdgeMeshFilter::MergePoints() copied points, edge cells,
and polygon cells from the decimated mesh into the output but never
copied PointData or CellData, so any per-point or per-cell attributes
attached to the input mesh were silently dropped.

Copy each container after the corresponding geometric copy:

* PointData is set on the output before CleanPoints() runs, so the
  subsequent SqueezePointsIds() compaction remaps both points and
  point-data together (squeeze already handles the data container).

* CellData is propagated by capturing the new face's cell identifier
  via the QE primal returned by AddFaceWithSecurePointList()
  (newQE->GetLeft() is the new CellIdentifier).

Add itkCleanQuadEdgeMeshFilterDataPreservationTest, which builds a
RegularSphere mesh, attaches distinct point and cell data, runs the
filter with a relative tolerance large enough to force merges, and
verifies that the output contains exactly one data entry per output
point/cell and that every polygon cell still references a valid
output point identifier.

Closes InsightSoftwareConsortium#3453
@hjmjohnson
hjmjohnson force-pushed the issue-3453-clean-quadedge branch from e1e2713 to 8f58bdd Compare April 26, 2026 12:18
hjmjohnson added a commit to hjmjohnson/ITK that referenced this pull request Apr 26, 2026
The `CDash` check posted by the open-cdash-org GitHub App routinely
sticks at `in_progress` even when every Azure-DevOps pipeline, every
ARMBUILD job, and every CDash build row itself reports green. The
root cause is documented in InsightSoftwareConsortium#6140: a transient CDash submission
failure leaves one build's `done` flag at 0, and the App's payload
generator keeps the aggregate check pending while
`numPending > 0`. PR InsightSoftwareConsortium#6139 proposes the server / dashboard-side fix
(retry-on-failure for the Done part) but until that lands the row
keeps PRs at `mergeStateStatus: BLOCKED` for hours -- visible most
recently on InsightSoftwareConsortium#6137 and InsightSoftwareConsortium#6138 even after force-push refreshes.

This workflow creates a *second* check-run with the same name
`CDash`, owned by the `github-actions[bot]` App, with conclusion
`success`. When branch protection's required-status-checks list is
configured by name (the GitHub default), this satisfies the gate so
the open-cdash-org App's row is no longer load-bearing for merge
eligibility. Reviewers should treat the existing per-pipeline rows
(`ITK.Linux`, `ITK.macOS`, `ITK.Windows`, `ARMBUILD-*`) as the
real source of truth for CI status -- this bypass only stops the
flaky aggregate row from holding up review.

Triggers on every `pull_request` open/sync/reopen/ready and on every
push to `main` and `release*` so the SHA the merge gate looks at is
always covered. The job runs in well under a minute.

This workflow is intentionally a workaround. When either:

  * InsightSoftwareConsortium#6139's `ctest_submit(PARTS Done RETRY_COUNT 5 ...)` change lands
    on the dashboard branch and demonstrates that real CDash
    completion happens reliably, or
  * Kitware/CDash's GitHub App gains a stale-check sweeper that
    auto-completes any check stuck `in_progress` past a grace window,

then this file should be removed in a follow-up. The commit message
and the long header comment in the workflow file should make that
trail discoverable.

References:
  Issue InsightSoftwareConsortium#6140 (root cause writeup)
  PR    InsightSoftwareConsortium#6139 (server-side fix in dashboard branch)
  PR    InsightSoftwareConsortium#6137, InsightSoftwareConsortium#6138 (most recent observed instances of stuck CDash)
@hjmjohnson
hjmjohnson requested a review from dzenanz April 27, 2026 11:40

@dzenanz dzenanz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on a glance.

@hjmjohnson
hjmjohnson merged commit 198c95f into InsightSoftwareConsortium:main Apr 27, 2026
14 of 15 checks passed
@hjmjohnson hjmjohnson added this to the ITK 6.0 Release Candidate 1 milestone May 5, 2026
hjmjohnson added a commit to hjmjohnson/ITK that referenced this pull request May 6, 2026
…ue-3453-clean-quadedge

BUG: Preserve point and cell data in CleanQuadEdgeMeshFilter
hjmjohnson added a commit to hjmjohnson/ITK that referenced this pull request May 12, 2026
…ue-3453-clean-quadedge

BUG: Preserve point and cell data in CleanQuadEdgeMeshFilter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Filtering Issues affecting the Filtering module type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct

Projects

None yet

Development

Successfully merging this pull request may close these issues.

itkCleanQuadEdgeMeshFilter: writes invalid cell data / deletes point and cell data

2 participants