ITKElastix icon indicating copy to clipboard operation
ITKElastix copied to clipboard

Reset random seed for deterministic registration

Open Pedro-Filipe opened this issue 2 months ago • 7 comments

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:

// **************** Image sampling **********************
(NumberOfSpatialSamples 2048)
(NewSamplesEveryIteration "true")
(ImageSampler "Random")
//(ImageSampler "Full")

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?

Pedro-Filipe avatar Apr 16 '24 09:04 Pedro-Filipe