-
Notifications
You must be signed in to change notification settings - Fork 22
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
Reset random seed for deterministic registration #279
Comments
How about |
You should be able too look up all the Elastix parameters here, but the page is not working for me right now. @N-Dekker @ViktorvdValk Is that just me, or is the page really down? |
@Pedro-Filipe Thanks for asking! It may be helpful to reset the global ITK random number generator before each registration. Which version of The idea is to call |
Thanks for reporting this problem @dzenanz It's hopefully back online soon. For the time being, you may use the Internet Archive: https://web.archive.org/web/20230204115458/https://elastix.lumc.nl/doxygen/parameter.html |
Thank you both for your comments. Really appreciate the support.
@dzenanz The parameter Make SimpleElastix more deterministic by setting RandomSeed #460 multiple SimpleElastix instances/runs ignore RandomSeed in ParameterFile #122
@N-Dekker I have these versions currently installed: itk 5.4rc2
itk-core 5.4rc2
itk-elastix 0.19.1
itk-filtering 5.4rc2
itk-io 5.4rc2
itk-numerics 5.4rc2
itk-registration 5.4rc2
itk-segmentation 5.4rc2 I have added this line of code before calling each registration: itk.MersenneTwisterRandomVariateGenerator.ResetNextSeed() It does reduce significantly the variation, although unfortunately not 100%. The values of the registered images differ after a few decimal places. |
@Pedro-Filipe I'm glad to hear that
(Not 100% sure about the syntax.) Does that further reduce the variation? Another cause of variation could be multi-threading. You see, internally, elastix may do some floating point operations in a different order, depending on the order in which the threads process the work units. Mathematically, it should not matter, but the order of those floating point operations might affect the floating point rounding errors. You may eliminate those effects by setting the number of threads to one, globally:
Obviously this may slow down the registration process. But it might still be interesting to know if that will totally eliminate all variations... I'm interested to hear what you will find! |
Thanks for the additional suggestions @N-Dekker . ResultsAlso using
|
Hi, I was wondering if there is a way to reset the random seed used by ITKElastix.
In my Python code if I register a set of images, and then if I repeat this registration in the same dataset in the next loop iteration, I get slightly different pixel values for the registered images. I believe at least some of the randomness comes from this part of my bspline registration recipe:
If I set sampler to
(ImageSampler "Full")
then the registration is deterministic, and I get the same results every iteration, but unfortunately it also takes significantly longer to register.So my question is: is there a way to reset the random seed in the python code?
The text was updated successfully, but these errors were encountered: