Closed zapaishchykova closed 1 year ago
@zapaishchykova Thank very much for submitting this issue, Anna. The issue is indeed caused by the image sampler using a random number generator (ImageSampler "Random"
). Internally it uses the MersenneTwisterRandomVariateGenerator
from ITK. Coincidentally I just submitted a proposal to allow resetting the next seed of that random number generator:
As far as I can see now, the proposed new function, ResetNextSeed()
, should allow making the registration deterministic! So please "like" (👍) that pull request!
Kind regards, Niels
And then it would be good to make use of it in elastix. This should also synchronize behavior with the command line executable, as that one is perfectly reproducible.
@N-Dekker awesome, what a great coincidence!
@mstaring do you by chance know the command line alternative for the itk.elastix_registration_method? is it this one https://manpages.ubuntu.com/manpages/trusty/man1/elastix.1.html? Then I can replace Python wrapper with some shell commands via subprocess.
Yes it seems someone made a binary package in ubuntu of elastix.
You can also get it from https://github.com/SuperElastix/elastix/releases/tag/5.1.0
perfect, thanks! Just tested the cmd - its indeed deterministic. I will stick to cmd version for now, while waiting for the pull request to be propagated to the Python library.
Hi there! Thanks for the great repo!
I have the following Parateters_Rigid.txt file(see below) and I am trying to find which parameters would make the registration deterministic. What I mean by that, is that for each run of the registration procedure, I want to get exactly the same result. I am using it for template matching of brain MRIs and I have observed a tiny delta between my images that occurs each time I run the registration (I am using python, itk-elastix library, itk.elastix_registration_method).
I have looked into the manual and I think that might have to do with ImageSampler, but I am not 100% sure ( https://readthedocs.org/projects/simpleelastix/downloads/pdf/latest/). Any guidance on this?
Thanks!