Skip to content

ENH: Re-enable Gaussian3D and NCC3D VariationalRegistration tests on macOS ARM64 - #6461

Merged
hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
hjmjohnson:reenable-vr-gaussian-ncc-3d-macos
Jun 17, 2026
Merged

hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
hjmjohnson:reenable-vr-gaussian-ncc-3d-macos

Conversation

@hjmjohnson

Copy link
Copy Markdown
Member

Re-enable the VariationalRegistrationGaussian3DTest and VariationalRegistrationNCC3DTest tests that were left disabled in #6453, using a small per-test pixel-count tolerance for native macOS ARM64. Closes #6459.

Why these two were disabled, and the measurement

In #6453, 11 of the 13 VariationalRegistration tests were re-enabled against ITK-proper baselines; Gaussian3D and NCC3D were held back because their outputs diverge from the x86_64 baselines on native macOS ARM64.

Measured on Apple silicon against the (94×70×56 = 368,480-voxel) baselines, after the existing radius-2 / intensity-20 neighborhood search:

Test Voxels differing Fraction Max intensity diff
Gaussian3D 308 0.084% 85
NCC3D 322 0.087% 53

This is sub-0.1% floating-point convergence drift — the regime --compareNumberOfPixelsTolerance exists to absorb — not a structural mismatch that would warrant a separate macOS baseline.

The fix

Test3D gains an optional ${TestName}_NPIXELS_TOL override that falls back to the global VR_NPIXELS_TOL (200). The two divergent tests set it to 400. The shared x86_64 baseline serves both platforms:

  • x86_64 stays bit-exact (0 ≤ 400)
  • macOS ARM64 passes (≤ 322 ≤ 400)
  • the other 11 tests keep the tight global tolerance of 200

No baseline (.cid) changes — the baselines already landed in #6453.

Local verification (macOS ARM64)

All 23 VariationalRegistration tests pass:

100% tests passed, 0 tests failed out of 23

pre-commit run --all-files: all content hooks (gersemi, clang-format, trailing-whitespace, end-of-file) pass.

These two 3D tests were left disabled in InsightSoftwareConsortium#6453 because their outputs
diverge from the x86_64 baselines on native macOS ARM64. Measured on
Apple silicon, ~0.08% of the 368480-voxel volume differs (308 voxels
for Gaussian3D, 322 for NCC3D) after the radius-2/intensity-20 search;
x86_64 remains bit-exact.

Add an optional per-test VariationalRegistration<Name>Test_NPIXELS_TOL
override to Test3D and set it to 400 for these two tests, so the
shared x86_64 baseline serves both platforms while the other 11 tests
keep the tight global tolerance of 200.

Closes InsightSoftwareConsortium#6459.
@github-actions github-actions Bot added type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots type:Enhancement Improvement of existing methods or implementation area:Registration Issues affecting the Registration module labels Jun 17, 2026
@hjmjohnson
hjmjohnson marked this pull request as ready for review June 17, 2026 15:44
@greptile-apps

greptile-apps Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Re-enables VariationalRegistrationGaussian3DTest and VariationalRegistrationNCC3DTest, which were held back in #6453 due to sub-0.1% floating-point divergence on native macOS ARM64. The fix adds a minimal per-test ${TestName}_NPIXELS_TOL override to Test3D and sets it to 400 for both tests (measured max: 322 differing voxels out of 368,480).

  • Test3D now checks for an optional ${TestName}_NPIXELS_TOL variable before falling back to the global VR_NPIXELS_TOL (200), keeping all other 11 tests at the tighter tolerance.
  • Both newly-enabled tests share the existing x86_64 baseline (.cid) — no new baseline files are added.

Confidence Score: 5/5

Safe to merge — a single CMakeLists.txt change that re-enables two test cases with empirically-measured, well-documented per-test tolerances and no baseline modifications.

The change is confined to the test CMakeLists.txt, uses correct CMake scoping (function children inherit parent-scope variables so the DEFINED check works as intended), and every tolerance value is backed by a concrete pixel-count measurement. All 11 unaffected 3D tests retain the tighter global tolerance of 200, so there is no regression risk for those tests.

No files require special attention.

Important Files Changed

Filename Overview
Modules/Registration/VariationalRegistration/test/CMakeLists.txt Adds a per-test pixel-count tolerance override to Test3D and re-enables Gaussian3D and NCC3D with tolerance 400; CMake scoping is correct (function inherits parent variables), and all other tests retain the global tolerance of 200.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Test3D(TestName, ...)"] --> B{"DEFINED\n${TestName}_NPIXELS_TOL?"}
    B -- Yes --> C["npixels_tol = ${TestName}_NPIXELS_TOL\n(e.g. 400 for Gaussian3D / NCC3D)"]
    B -- No --> D["npixels_tol = VR_NPIXELS_TOL\n(global default: 200)"]
    C --> E["itk_add_test\n--compareNumberOfPixelsTolerance npixels_tol"]
    D --> E
    E --> F{"Platform"}
    F -- "x86_64\n(0 differing pixels)" --> G["✅ 0 ≤ 400 → PASS"]
    F -- "macOS ARM64\n(≤322 differing pixels)" --> H["✅ 322 ≤ 400 → PASS"]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A["Test3D(TestName, ...)"] --> B{"DEFINED\n${TestName}_NPIXELS_TOL?"}
    B -- Yes --> C["npixels_tol = ${TestName}_NPIXELS_TOL\n(e.g. 400 for Gaussian3D / NCC3D)"]
    B -- No --> D["npixels_tol = VR_NPIXELS_TOL\n(global default: 200)"]
    C --> E["itk_add_test\n--compareNumberOfPixelsTolerance npixels_tol"]
    D --> E
    E --> F{"Platform"}
    F -- "x86_64\n(0 differing pixels)" --> G["✅ 0 ≤ 400 → PASS"]
    F -- "macOS ARM64\n(≤322 differing pixels)" --> H["✅ 322 ≤ 400 → PASS"]
Loading

Reviews (1): Last reviewed commit: "ENH: Re-enable Gaussian3D and NCC3D Vari..." | Re-trigger Greptile

@hjmjohnson
hjmjohnson merged commit 6e5b291 into InsightSoftwareConsortium:main Jun 17, 2026
22 checks passed
@hjmjohnson
hjmjohnson deleted the reenable-vr-gaussian-ncc-3d-macos branch August 22, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Registration Issues affecting the Registration module type:Enhancement Improvement of existing methods or implementation type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VariationalRegistration: Gaussian3D and NCC3D tests diverge on native macOS ARM64 (re-enable follow-up to #6453)

3 participants