Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AdaptiveHistogramEqualizationImageFilter is not deterministic any more #960

Open
dzenanz opened this issue May 23, 2019 · 5 comments

Comments

Projects
None yet
3 participants
@dzenanz
Copy link
Member

commented May 23, 2019

https://github.com/InsightSoftwareConsortium/ITKExamples/tree/master/src/Filtering/ImageStatistics/AdaptiveHistogramEqualizationImageFilter produces a different result for AdaptiveHistogramEqualizationImageFilterTest01Baseline each time it is run.

@fbudin69500

This comment has been minimized.

Copy link
Contributor

commented May 23, 2019

Can this be done by setting the value of the random seed or something similar to force the test to be deterministic?

@blowekamp

This comment has been minimized.

Copy link
Member

commented May 23, 2019

I was just looking at this class. Looks like I was the last one to do a significant refactoring to it. There should be nothing "random" in the algorithm.

@blowekamp

This comment has been minimized.

Copy link
Member

commented May 23, 2019

I believe I have narrowed the problem down to this commit:
0e2d4f2#diff-49fb7eed661fcc26494efe4c6e13a5bbR125

@dzenanz

This comment has been minimized.

Copy link
Member Author

commented May 23, 2019

I also though that was the most likely culprit. The most obvious thing to try is replace unordered_map by map. But no changes were made directly to AdaptiveHistogramEqualizationImageFilter, which means that other classes might be affected too. And if the differences are purely numerical, does that even matter (as long as results are deterministic)?

@blowekamp

This comment has been minimized.

Copy link
Member

commented May 24, 2019

I have looked into this example a bit. It is the case where alpha==beta==0. This simplifies most terms so that the cumulants and +/- 0.5. Additionally the radius is just 1. I think that this is just a rounding/tolerance issue. There are things that can be done in improve the numeric stability of AdaptiveEqualizationHistogram::GetValue.

I'm not sure this is a "bug"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.