Skimage.transform.warp could use _warp_fast for order 0

Hello,

I was taking a look at skimage.transform.warp and it seems that it use the Cython routine only for order 1-3, due to this conditon:

if order in (0, 3) and not map_args:

However, looking at _warp_fast in _warps_cy.pyx it seems like there exists an implementation for order 0:

if order == 0:
        interp_func = nearest_neighbor_interpolation[np_floats, np_floats, np_floats]

Is there a reason for this limitation?

Hey :slight_smile:

It seems that the Cython pathway for order == 0 was removed in Fix warp output dtype when order=0 by rfezzani · Pull Request #5327 · scikit-image/scikit-image · GitHub to preserve the input range and dtype. Maybe to align with other interpolating behavior?

Do you have a use case for which it is it a limitation? I haven’t looked into whether this had negative performance implications? Might be that the fallback map_coordinates isn’t significantly slower anyway.

Oh, and sorry for the long response time. :pray: