Open gregsharp opened 3 years ago
The behavior expected here is quite related to a recent additional feature added to SimpleITK to support optimizers "StopOptimization" or "StopRegistration" method.
Here is the SimpleITK PR: https://github.com/SimpleITK/SimpleITK/pull/1407
The test in interesting because it check for the behavior with 7 different v4 optimizers.
Related to this issue, with some optimizers when manually stopping, the last iteration is the best but it is not set and the final best position. This behavior is not consistent across the optimizers. However, for the GradientDecentOptimizerv4 the "correct", best, and last position is the result.
CC @hjmjohnson @ntustison @stnava
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.
Description
The GradientDescentOptimizerv4 algorithm does not correctly keep track of the score and position (Parameters). This causes issues:
See Discourse for discussion
https://discourse.itk.org/t/imageregistrationmethodv4-questions/4117/7
Steps to Reproduce
The link below is a test program that reproduces the problem. It needs a bit of work to become a standalone test but should illustrate how to reproduce. At iteration zero, the observer for AmoebaOptimizerv4 correctly reports that the position is zero whereas the observer for RegularStepGradientDescentOptimizerv4 reports the correct score, but the wrong position.
https://gitlab.com/plastimatch/plastimatch/-/blob/master/src/plastimatch/test/itk_registration_v4.cxx
Expected behavior
At iteration zero, the position is zero and so the printout should display
0 17208.6 [0, 0, 0]
Actual behavior
But instead it displays
0 17208.6 [14.999996789911513, -0.006939114154077091, -0.006939116585946947]
Reproducibility
100% reproducible
Versions
ITK 4.12 and 5.1.2 both exhibit this problem. Probably other versions do too.
Environment
Additional Information