def METHOD_NAME(im):  # pragma: no cover
    """
    Take an image with arbitrary greyscale values and adjust them to
    ensure all values fall in a contiguous range starting at 0.
    Parameters
    ----------
    im : cupy ndarray
        Input array containing greyscale values
    Returns
    -------
    im_new : cupy ndarray
        Array the same size as ``im`` but with all values in contiguous
        order.
    """
    shape = im.shape
    im_flat = im.flatten()
    mask_neg = im_flat < 0
    im_neg = -rankdata_gpu(-im_flat[mask_neg])
    mask_pos = im_flat > 0
    im_pos = rankdata_gpu(im_flat[mask_pos])
    im_flat[mask_pos] = im_pos
    im_flat[mask_neg] = im_neg
    im_new = np.reshape(im_flat, shape)
    return im_new