Gradient magnitude (0) at the first iteration

Hi, the iteration stopped at the first iteration no matter what the initial transform parameters are and the stop reason is " RegularStepGradientDescentOptimizer: Gradient magnitude tolerance met after 0 iterations. Gradient magnitude (0) is less than gradient magnitude tolerance (0.0001)."


In the two pictures, the changes of metric values are small but not zero, so the gradient should not be zero, right?

The optimizer, metric and registration method are itkRegularStepGradientDescentOptimizer.h , itkMattesMutualInformationImageToImageMetric.h and itkMultiResolutionImageRegistrationMethod.h, respectively. However, when I change the metric to itkGradientDifferenceImageToImageMetric.h, it can run normally and will not stop at the first iteration. But the metric value is too large and the gradient is also too large. So maybe the itkGradientDifferenceImageToImageMetric.h is a not suitable metric for the registration.

Someone else has posed " Gradient magnitude (0) in registration." and the solutions in her topic seems not help to my problem. What else can I do to solve this problem?