Difference between RANDOM, REGULAR and NONE sampling

I have run the same registration code snippet, with the same data and same sampling strategy, multiple times. I get different result each time. With RANDOM sampling, this is understandable, but why should REGULAR and NONE sampling show different result each time?

I think that it was already discussed on this forum, that mutual information metric is not fully reproducible. It depends on the thread-related order of operations (merging results from multiple threads). I think that conclusion was that eliminating this is somewhat costly in terms of performance, and requires non-trivial engineering effort.

If you use random strategy, setting a deterministic seed should eliminate randomness from run to run. If you combine that (or regular sampling) with single thread for the metric, you should have reproducible results.

2 Likes

As I recall all the sampling strategies randomly perturb the sampling point a little bit. For reproducibility the MetricSamplingReinitializeSeed should always be set.

2 Likes

The NONE strategy does not apply a perturbation in the itkImageRegistrationMethodv4 class, but it will still not be fully reproducible if using mutual information with multiple threads.