def _compose(image, vec_field, color_axis):
if color_axis == <NUM_LIT:2>:<EOL><INDENT>image = _transpose_image(image)<EOL><DEDENT>c, h, w = image.shape  <EOL>hrange = np.arange(h)<EOL>wrange = np.arange(w)<EOL>MGx, MGy = np.meshgrid(wrange, hrange)<EOL>defMGx = (MGx + vec_field[:, :, <NUM_LIT:0>]).clip(<NUM_LIT:0>, w - <NUM_LIT:1>)<EOL>defMGy = (MGy + vec_field[:, :, <NUM_LIT:1>]).clip(<NUM_LIT:0>, h - <NUM_LIT:1>)<EOL>new_image = np.empty_like(image)<EOL>for channel in range(c):<EOL><INDENT>interpolation = RectBivariateSpline(hrange, wrange, image[channel],<EOL>kx=<NUM_LIT:1>, ky=<NUM_LIT:1>)<EOL>new_image[channel] = interpolation(defMGy, defMGx, grid=False)<EOL><DEDENT>if color_axis == <NUM_LIT:2>:<EOL><INDENT>return _re_transpose_image(new_image)<EOL><DEDENT>else:<EOL><INDENT>return new_image<EOL><DEDENT>
Calculate the composition of the function image with the vector
    field vec_field by interpolation.
    new_func = compose(image, vec_field)
    In:
    image: numpy.ndarray
        of shape C x h x w with C = 3 or C = 1 (color channels),
        h, w >= 2, and [type] = 'Float' or 'Double'.
        Contains the values of a function f: R ^ 2 -> R ^ C
        on the grid {0, ..., h - 1} x {0, ..., w - 1}.
    vec_field: numpy.array
        of shape (h, w, 2)
    vec_field[y, x, 0] is the x-coordinate of the vector vec_field[y, x]
    vec_field[y, x, 1] is the y-coordinate of the vector vec_field[y, x]
    positive x-direction is along rows from left to right
    positive y-direction is along columns from above to below