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

Fix registration random seed #599

Merged
merged 6 commits into from
Jun 11, 2018
Merged

Fix registration random seed #599

merged 6 commits into from
Jun 11, 2018

Conversation

cookpa
Copy link
Member

@cookpa cookpa commented Jun 11, 2018

antsRegistration, antsAI, antsMotionCorr now take the "--random-seed" option. This lets the user set a non-zero seed, which is passed on to the registration method.

The order of precedence is:

  1. Command line --random-seed
  2. A non-null environment variable ANTS_RANDOM_SEED
  3. Whatever the old default was (fixed for antsAI, system time for others)

Passing "--random-seed 0" will result in system time being used.

@ntustison
Copy link
Member

This is great @cookpa ! Much appreciated.

@ntustison ntustison merged commit cf933a0 into master Jun 11, 2018
@stnava
Copy link
Member

stnava commented Jun 11, 2018 via email

@yarikoptic
Copy link
Contributor

Cool. I wonder - what is the use case for having system time for a seed? (Ie how different from not seeding at all? Not that your would then try to match it up somehow)

@cookpa
Copy link
Member Author

cookpa commented Jun 12, 2018

The RNG requires a seed. If you don't specify one, then ITK will use the system time.

https://itk.org/Doxygen/html/classitk_1_1Statistics_1_1MersenneTwisterRandomVariateGenerator.html

The idea is that you can have a different seed for each execution of the code. This can go wrong in parallel processing, because multiple jobs might start at the same time. But the impact in the registration context should be fairly minimal. For processes that rely heavily on good-quality randomness, it's more of a problem.

@stnava stnava deleted the fixRegistrationRandomSeed branch June 12, 2018 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants