Moving-Least-Squares
Moving-Least-Squares copied to clipboard
When pTwp is not invertible in affine deformation
Hi, I am a little confused about the code dealing with the situation when pTwp is not invertible in affine deformation (line94 in img_utils.py). If I’m not mistaken, code directly set M to be an identity matrix (according to line 129, 130) when the determinant is close to zero. I supposed this kind of issue should be done by pseudo-inverse. This discussion in stackoverflow should help: https://stackoverflow.com/questions/49357417/why-is-numpy-linalg-pinv-preferred-over-numpy-linalg-inv-for-creating-invers
Thanks for the implementation.
Besides, I think the calculation of the adjoint matrix (line 99) is also wrong. It should be adjoint = pTwp[[[1, 1], [0, 1]], [[1, 0], [0, 0]], :, :]
.