So in my Affine registration between the same subject , the graph for iterations and metric value looks something like this

Where there is a spike after 100th iteration . Is there a way to stop at the convergence value around 100th iteration . I’m using

registration_method.SetMetricAsCorrelation()

registration_method.SetInterpolator(sitk.sitkLinear)

and

registration_method.SetOptimizerAsGradientDescent(

learningRate=1.0, numberOfIterations=100,convergenceMinimumValue=1e-6) # , estimateLearningRate=registration_method.EachIteration)

registration_method.SetOptimizerScalesFromPhysicalShift()

final_transform = sitk.AffineTransform(initial_transform)

registration_method.SetInitialTransform(final_transform)

registration_method.SetShrinkFactorsPerLevel(shrinkFactors=[4, 2, 1])

registration_method.SetSmoothingSigmasPerLevel(smoothingSigmas=[2, 1, 0])

registration_method.SmoothingSigmasAreSpecifiedInPhysicalUnitsOn()

Thank you