Why mode='empty' not available for warp()?

skimage.transform.warp has a keyword mode, which defines values of the points outside of the image. It refers to numpy.pad. How can I pad my image with NaNs during warping? Numpy documentation says to use mode=‘empty’, but it does not seem to be supported by scikit-image.

For my use case, I want to discard regions of interest which are outside of the warped image. It is not the same as assuming that intensity inside these regions is zero

I found a hack:

big = np.max(img) * 100
rez = warp(img, transform, mode='constant', cval=big)
rez[rez > big / 10] = np.nan

Could you please clarify the difference between what you seek and

rez = warp(img, transform, mode='constant', cval=np.nan)

I’m afraid I don’t quite follow.

There is no difference. I failed to see the elephant in the room :smiley: Thanks for the reply

Ah, phew :joy: You had me worried there for a second! Glad that solved your problem.