I noticed that when resampling an image using
sitkBSpline, the background would not always be zero.
Here is an example:
import SimpleITK as sitk import numpy as np x = np.zeros((20,20)) x[5:15,5:15] = 1 img = sitk.GetImageFromArray(x) tx = sitk.Euler2DTransform() tx.SetAngle(np.deg2rad(30)) out = sitk.Resample(img, tx, sitk.sitkBSpline) out2 = sitk.Resample(img, tx, sitk.sitkBSplineResampler) plt.imshow(sitk.GetArrayFromImage(out)); plt.show() plt.imshow(sitk.GetArrayFromImage(out2)); plt.show()
sitkBSpline creates values less than 0 and greater than 1, which is not the case for
The documentation says that the latter interpolator should only be used for ‘a BSpline coefficient image’, however for me it looks like that it produces the better results? Especially as I would not suspect that the resampler introduces higher or lower values which were in the image before.
Is it save to use the
sitkBSplineResampler as a default resampler instead of
sitkBSpline, or is there any caveat I’m not aware of?
SimpleITK Version: 2.0.0rc1.post287
Build Date: Jun 19 2020 02:53:28
ITK Version: 5.1