code: def interpolate_img(
      img, coords, order=3, mode="nearest", cval=0.0, is_seg=False
  ):
      if is_seg and order != 0:
          unique_labels = np.unique(img)
          result = np.zeros(coords.shape[1:], img.dtype)
          for i, c in enumerate(unique_labels):
              res_new = map_coordinates(
                  (img == c).astype(float),
                  coords,
                  order=order,
                  mode=mode,
                  cval=cval,
              )
              result[res_new >= 0.5] = c
          return result
      else:
          return map_coordinates(
              img.astype(float),
              coords,
              order=order,
              mode=mode,
              cval=cval,
          ).astype(img.dtype)
  
imports: import random
  import numpy
  import paddle
  from paddle.nn.functional import avg_pool2d, avg_pool3d
  from typing import List, Tuple, Union, Callable
  from copy import deepcopy
  from scipy.ndimage import map_coordinates, fourier_gaussian
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
  from scipy.ndimage.morphology import grey_dilation
  from skimage.transform import resize
  from scipy.ndimage.measurements import label
label_desc: Use image node_id 25 for calling a global function with example usage: interpolate_img(img, coords, order, mode, cval, is_seg) and returns: result, map_coordinates