Skip to content

Conversation

@CavRiley
Copy link

@CavRiley CavRiley commented Jan 8, 2026

Description

This PR updates the baseline images for ConnectedComponent tests following the changes in PR #5622, which replaced vnl_sample.h with <random>. The switch to the standard library random number generator produced different random sequences, causing the existing baseline images to fail validation.

Related Issues/PRs

Follow-up to #5622

PR Checklist

  • No API changes were made (or the changes have been approved)
  • No major design changes were made (or the changes have been approved)
  • Added test (or behavior not changed)
  • Updated API documentation (or API not changed)
  • Added license to new files (if any)
  • Added Python wrapping to new files (if any) as described in ITK Software Guide Section 9.5
  • Added ITK examples for all new major features (if any)

Testing

Baseline images were regenerated by running the ConnectedComponent tests with the updated random number generator. All tests now pass with the new baselines.

@github-actions github-actions bot added type:Enhancement Improvement of existing methods or implementation type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct area:Segmentation Issues affecting the Segmentation module type:Data Changes to testing data labels Jan 8, 2026
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Thank you for contributing a pull request! 🙏

Welcome to the ITK community! 🤗👋☀️

We are glad you are here and appreciate your contribution. Please keep in mind our community participation guidelines. 📜
More support and guidance on the contribution process can be found in our contributing guide. 📖

This is an automatic message. Allow for time for the ITK community to be able to read the pull request and comment
on it.

@N-Dekker
Copy link
Contributor

N-Dekker commented Jan 8, 2026

@CavRiley Would it be nice to squash your commit and mine together? I feel that one commit cannot live without the other 😸

If you like that, feel free to squash the two commits, and then please add me as co-author! (At the end of your commit message, Co-authored-by: Niels Dekker <[email protected]>.)

@blowekamp
Copy link
Member

What were the .1 alternate bases lines generated?

They have some ### times been different results from different platforms, when the results are not always consistent.

@dzenanz
Copy link
Member

dzenanz commented Jan 8, 2026

Ah, well noticed Brad. The baselines should be replaced, not added.

@CavRiley
Copy link
Author

CavRiley commented Jan 8, 2026

What were the .1 alternate bases lines generated?

They have some ### times been different results from different platforms, when the results are not always consistent.

The .1 alternate baselines were regenerated to account for platform-specific differences in the test outputs.

I generated the primary .png baseline on a Mac machine and the .1 alternative on a Linux machine. During testing, I noticed that the Mac-generated baseline did not fix the test failures on Linux, which is why the .1 alternative was changed.

Let me know if this answered your question!

@N-Dekker
Copy link
Contributor

N-Dekker commented Jan 8, 2026

The baselines should be replaced, not added.

It seems reasonable to me to still keep the old baseline as well, so that at least the final ITK 5.x release can still pass the tests. Right?

@dzenanz
Copy link
Member

dzenanz commented Jan 8, 2026

Yes, that does answer my question Cavan.

Niels, we don't need old test baselines in the main branch. During release process, then-current test data is archived.

Copy link
Member

@hjmjohnson hjmjohnson left a comment

Choose a reason for hiding this comment

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

@CavRiley Nice work!

Copy link
Contributor

@N-Dekker N-Dekker left a comment

Choose a reason for hiding this comment

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

Thanks @CavRiley ! Cool!

Approved, but please consider squashing the two commits 😃

Follow-up to pull request InsightSoftwareConsortium#5611
commit f7daf24
"ENH: Replace "vnl/vnl_sample.h" with `<random>`, in Core tests"

The random number generator change affected test outputs, requiring updated baseline images as well.

Co-authored-by: Niels Dekker <[email protected]>
@CavRiley CavRiley force-pushed the Update-connected-component-testing-baselines branch from 8d457c0 to 415d2ed Compare January 8, 2026 22:22
@CavRiley
Copy link
Author

CavRiley commented Jan 8, 2026

Thanks @CavRiley ! Cool!

Approved, but please consider squashing the two commits 😃

Sorry I just got to this. I hope it looks alright!

@N-Dekker N-Dekker self-requested a review January 9, 2026 09:53
Copy link
Contributor

@N-Dekker N-Dekker left a comment

Choose a reason for hiding this comment

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

Thank you for squashing, @CavRiley! Even more approved! 😃

@hjmjohnson hjmjohnson merged commit fd4e069 into InsightSoftwareConsortium:main Jan 9, 2026
17 checks passed
@blowekamp
Copy link
Member

What were the .1 alternate bases lines generated?
They have some ### times been different results from different platforms, when the results are not always consistent.

The .1 alternate baselines were regenerated to account for platform-specific differences in the test outputs.

I generated the primary .png baseline on a Mac machine and the .1 alternative on a Linux machine. During testing, I noticed that the Mac-generated baseline did not fix the test failures on Linux, which is why the .1 alternative was changed.

Let me know if this answered your question!

Thank you for making this contribution!

Do you have any insight why different results are occuring? Is the same random image being generated on the two platforms? Or is the filter just producing different results?

@N-Dekker
Copy link
Contributor

N-Dekker commented Jan 9, 2026

Do you have any insight why different results are occuring? Is the same random image being generated on the two platforms? Or is the filter just producing different results?

Interesting! I would expect the same pseudo-random number sequence on all platforms 🤷

@CavRiley
Copy link
Author

CavRiley commented Jan 9, 2026

Do you have any insight why different results are occuring? Is the same random image being generated on the two platforms? Or is the filter just producing different results?

I agree with @N-Dekker in that I would expect the same number sequence on each platform, but my best guess is that std::uniform_int_distribution may produce differing values based on platform.

@N-Dekker
Copy link
Contributor

N-Dekker commented Jan 9, 2026

I agree with @N-Dekker in that I would expect the same number sequence on each platform, but my best guess is that std::uniform_int_distribution may produce differing values based on platform.

Wow, that's a pity! Thanks @CavRiley! I did not realize before that the result of std::uniform_int_distribution is platform-dependent. But now I see: https://www.reddit.com/r/cpp/comments/7i21sn/til_uniform_int_distribution_is_not_portable/

So the random number engine produces the same sequence on all platforms, but the "distribution" does not!

Before our PR, did all platforms share the same baselines?

@CavRiley
Copy link
Author

CavRiley commented Jan 9, 2026

Before our PR, did all platforms share the same baselines?

No, previously they did not share the same baselines! I only updated the existing baseline files.

@N-Dekker
Copy link
Contributor

N-Dekker commented Jan 9, 2026

No, previously they did not share the same baselines! I only updated the existing baseline files.

So originally, the baseline files were already platform dependent! Interesting, thanks @CavRiley!

Maybe we could introduce our own (ITK specific) platform-independent alternative to uniform_int_distribution. But that would be a pity, because my original indention was to do things more "standardize", by using the std <random> library.

For unit tests, the quality of the distribution usually doesn't matter so much, but for testing, reproducibility does matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Segmentation Issues affecting the Segmentation module type:Data Changes to testing data type:Enhancement Improvement of existing methods or implementation 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.

5 participants