Have a look at `skimage._shared.interpolation.pyx`, maybe you can reuse it here.