BUG: Remove std distribution from ConnectedComponentImageFilter tests + new baselines#6147
Conversation
1f15823 to
42010f2
Compare
|
| Filename | Overview |
|---|---|
| Modules/Segmentation/ConnectedComponents/test/itkConnectedComponentImageFilterTest.cxx | Replaces std::uniform_int_distribution with explicit modulo for cross-platform determinism; introduces uint32_t without <cstdint>. |
| Modules/Segmentation/ConnectedComponents/test/itkConnectedComponentImageFilterTestRGB.cxx | Identical RNG fix as the non-RGB test; same missing <cstdint> issue for uint32_t. |
| Testing/Data/Baseline/BasicFilters/ConnectedComponentImageFilterTest.png.cid | CID updated to new deterministic baseline; companion .1 alternate deleted as expected. |
| Testing/Data/Baseline/BasicFilters/ConnectedComponentImageFilterTest2.png.cid | CID updated to new deterministic baseline; companion .1 alternate deleted as expected. |
| Testing/Data/Baseline/BasicFilters/ConnectedComponentImageFilterTest3.png.cid | CID updated to new deterministic baseline; companion .1 alternate deleted as expected. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[mt19937 engine\nseeded with 1031571] --> B[randomNumberEngine]
B --> C["raw value = randomNumberEngine()"]
C --> D["% (maxValue - minValue + 1) + minValue\n= % 171 + 85"]
D --> E["static_cast to RGBComponentType\nrange: [85, 255]"]
E --> F[colormap entry R/G/B channel]
F --> G[repeat for all 3 channels]
G --> H[std::generate fills px]
H --> I[colormap stored]
I --> J[colormap indexed by label\nto produce output RGB image]
J --> K[writer produces deterministic PNG\nacross libstdc++ / libc++ / MSVC]
Reviews (1): Last reviewed commit: "BUG: Update ConnectedComponentImageFilte..." | Re-trigger Greptile
42010f2 to
da7d860
Compare
da7d860 to
380f51c
Compare
|
Thanks @hjmjohnson !
Of course, you could have asked me to switch on maintainerCanModify 🤷 By default, I switch off "Allow edits by maintainers", because I want to have a little bit of control over my own PRs. But in this case, I would certainly be willing to allow edits by maintainers. I'm glad that test data uploading is finally working again! 🎉 I would suggest squashing the two commits into one. Because the first commit cannot be applied "alone". It must go "hand in hand" with the new test data references. |
`std::uniform_int_distribution` appears to produce different distributions on different platforms. For the ConnectedComponentImageFilter tests, it appears preferable to use the same sequence of random numbers on all platforms. Follow-up to pull request InsightSoftwareConsortium#5725 commit 415d2ed, "ENH: Replace "vnl_sample.h" with `<random>` in ConnectedComponent tests", Jan 9, 2026.
380f51c to
8a597c7
Compare
bf222b7
into
InsightSoftwareConsortium:main
Successor to #5836 (which is blocked on
maintainerCanModify=offso the merged baselines could not be wired up). Carries @N-Dekker's RNG fix (preserving authorship), with theWIP:prefix dropped now that the baselines are landed; plus a follow-up commit that points the.cidcontent links at the new baselines just merged via ITKTestingData#38.Verified locally on macOS 15 / Apple Clang Release:
itkConnectedComponentImageFilterTest{,RGB,2,3}all pass against the new primary baselines, no fall-through to alternates.Commits
BUG: Remove std distribution from ConnectedComponentImageFilter tests— @N-Dekker's commit, authorship preserved; rebased onto currentupstream/mainand reworded only to drop theWIP:prefix that ghostflow rejected. Replacesstd::uniform_int_distributionwith an explicit modulo expression sostd::mt19937output reduces identically acrosslibstdc++/libc++/ MSVC.BUG: Update ConnectedComponentImageFilter test baselines for deterministic RNG— updates the three primary.cidfiles to the new merged CIDs and deletes the three.1per-platform alternates that existed only to paper over the prior cross-stdlib divergence.New CIDs
Test.png(also reused by...TestRGB)bafkreibyjpytxv46k6mkxo3sadppjvs6b5vjqwqcz6u4vkzpp2btmge4fmTest2.pngbafkreif6vtfmpapapqk5q5xlitj7g72pdihcrrncdf5cwgtnexu36cj6rmTest3.pngbafkreibxbxqmcg73nig3ncv7gt2rqdcj7nfw72r3be4r6l5llmqw4wpwruBlobs are in
ITKTestingData@gh-pages, commitd89fd19. Thedata.kitware.comanditk.org/files/ExternalDatamirrors may take a few minutes to publish; CDash CI will fall back to IPFS gateways or directly to gh-pages until then.Diff stat
Closes #5836 once merged.