Here is a very simple example of an image registration:
import SimpleITK as sitk
x = sitk.Image(50, 50, sitk.sitkFloat32)
x[10:40,10:40] = 1
y = sitk.Image(50, 50, sitk.sitkFloat32)
y[15:45,15:45] = 1
sitk.ProcessObject.SetGlobalWarningDisplay(True)
R = sitk.ImageRegistrationMethod()
R.SetInitialTransform(sitk.TranslationTransform(2))
R.SetMetricAsMeanSquares()
R.SetOptimizerAsLBFGSB()
print(R.Execute(x,y))
Unfortunately, it prints all the time this warning:
WARNING: In /tmp/SimpleITK-build/ITK/Modules/Numerics/Optimizersv4/src/itkLBFGSBOptimizerv4.cxx, line 99
LBFGSBOptimizerv4 (0x557d34e68130): LBFGSB optimizer does not support scaling. All scales are set to one.
I wondered why I get this, because I never set any scales myself.
I think I followed the code correctly and this is where the SetScales
member is called: SimpleITK/sitkImageRegistrationMethod.cxx at cd7cd20bb1f5ed846ec5d4686a1e1997822521e2 · SimpleITK/SimpleITK · GitHub
However, it should not even be called because when I run R.GetOptimizerScales()
it returns ()
and I can not see how it is set otherwise.
Thus, I wonder why I see this warning? Is there anything I can do to get rid of it?
Of course, I can turn off warnings, but that would also mean I might miss other warnings…