-
-
Notifications
You must be signed in to change notification settings - Fork 380
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
BSplineSyN registration non-deterministic with sampling strategy != NONE #1475
Comments
Thanks @cookpa . This is actually a two-part bug. The first one is in ANTs and here's the fix. The problem was that when the SyN method was refactored for special treatment, setting the metric sampling strategy and percentage was never included in the refactoring. So anytime SyN was called, "None" was used for the sampling strategy regardless of what the user set. So with this fix, both BSplineSyN and SyN behave similarly which is good in that sampling is now actually employed for both but now neither one are reproducible regardless of single-threading and explicit random seed setting. This latter problem is corrected by changing this line to
I'll post an ITK pull request tomorrow. |
Okay, once we update the ITK version, I think everything should be fixed now. |
Thanks for looking at this @ntustison, I'll try this out. BTW, would you mind making future changes via PR? That will let them be automatically added to the release notes. If desirable, you can bypass running the CI tests by putting "[skip actions]" (no quotes needed) in your commit message and merge right away. For things like this I often expand the automated description from the PR, but it's helpful to have the prompt so I don't forget to mention them. |
Sure thing---I'll try to remember. |
@ntustison I'm building the patched ITK now and looking at the code. I'm having trouble seeing how the patch affects the BSplineSyN registration in particular. For example, Affine or GaussianDisplacementField both worked before, and it seems they are prepared the same way by the ants registration helper. Does BSplineSyN do anything special with random numbers? I see that greedy SyN is a special case, which explains why your other commit (to ANTs) was needed. Thanks |
I actually played around with the GaussianDisplacementField transform as well and I thought I noticed it behaving similarly to BSplineSyN. So I don't know why it was working for you. If you take a look at the function SetMetricSamplePoints, you'll see that |
I see the initialization in the constructor, but I thought that would be overwritten in GenerateData
after the above, At first I thought it was because This is what I don't get, if
This is strange! I'll re-check my experiments |
Yeah, I noticed that, too, but one other thing I did to run down the issue was to print out |
I still don't get how, but the patch to |
Yeah, I don't disagree with you--it's weird. But I'm glad both of those issues are fixed now. Thanks. |
Describe the problem
If a sampling strategy is used, BSplineSyN registrations are non-deterministic even when single-threaded and with a fixed seed.
To Reproduce
Using data from templateflow:
If I replace the transform with
-t GaussianDisplacementField[ 0.1, 3, 0 ]
, the results are repeatable.System information (please complete the following information)
ANTs version information
The text was updated successfully, but these errors were encountered: