def map_coordinates(input, coordinates, output_type=None, output=None, order=3, mode='constant', cval=0.0, prefilter=True):
    "\n    Map the input array to new coordinates by interpolation.\n\n    The array of coordinates is used to find, for each point in the output,\n    the corresponding coordinates in the input. The value of the input at\n    those coordinates is determined by spline interpolation of the\n    requested order.\n\n    The shape of the output is derived from that of the coordinate\n    array by dropping the first axis. The values of the array along\n    the first axis are the coordinates in the input array at which the\n    output value is found.\n\n    Parameters\n    ----------\n    input : ndarray\n            The input array\n    coordinates : array_like\n                  The coordinates at which `input` is evaluated.\n    output_type : deprecated\n                  Use `output` instead.\n    output : dtype, optional\n             If the output has to have a certain type, specify the dtype.\n             The default behavior is for the output to have the same type\n             as `input`.\n    order : int, optional\n            The order of the spline interpolation, default is 3.\n            The order has to be in the range 0-5.\n    mode : str, optional\n           Points outside the boundaries of the input are filled according\n           to the given mode ('constant', 'nearest', 'reflect' or 'wrap').\n           Default is 'constant'.\n    cval : scalar, optional\n           Value used for points outside the boundaries of the input if\n           `mode='constant`. Default is 0.0\n    prefilter : bool, optional\n                The parameter prefilter determines if the input is\n                pre-filtered with `spline_filter`_ before interpolation\n                (necessary for spline interpolation of order > 1).\n                If False, it is assumed that the input is already filtered.\n\n    Returns\n    -------\n    return_value : ndarray\n                   The result of transforming the input. The shape of the\n                   output is derived from that of `coordinates` by dropping\n                   the first axis.\n\n\n    See Also\n    --------\n    spline_filter, geometric_transform, scipy.interpolate\n\n    Examples\n    --------\n    >>> import scipy.ndimage\n    >>> a = np.arange(12.).reshape((4,3))\n    >>> print a\n    array([[  0.,   1.,   2.],\n           [  3.,   4.,   5.],\n           [  6.,   7.,   8.],\n           [  9.,  10.,  11.]])\n    >>> sp.ndimage.map_coordinates(a, [[0.5, 2], [0.5, 1]], order=1)\n    [ 2.  7.]\n\n    Above, the interpolated value of a[0.5, 0.5] gives output[0], while\n    a[2, 1] is output[1].\n\n    >>> inds = np.array([[0.5, 2], [0.5, 4]])\n    >>> sp.ndimage.map_coordinates(a, inds, order=1, cval=-33.3)\n    array([  2. , -33.3])\n    >>> sp.ndimage.map_coordinates(a, inds, order=1, mode='nearest')\n    array([ 2.,  8.])\n    >>> sp.ndimage.map_coordinates(a, inds, order=1, cval=0, output=bool)\n    array([ True, False], dtype=bool\n\n    "
    if ((order < 0) or (order > 5)):
        raise RuntimeError('spline order not supported')
    input = numpy.asarray(input)
    if numpy.iscomplexobj(input):
        raise TypeError('Complex type not supported')
    coordinates = numpy.asarray(coordinates)
    if numpy.iscomplexobj(coordinates):
        raise TypeError('Complex type not supported')
    output_shape = coordinates.shape[1:]
    if ((input.ndim < 1) or (len(output_shape) < 1)):
        raise RuntimeError('input and output rank must be > 0')
    if (coordinates.shape[0] != input.ndim):
        raise RuntimeError('invalid shape for coordinate array')
    mode = _extend_mode_to_code(mode)
    if (prefilter and (order > 1)):
        filtered = spline_filter(input, order, output=numpy.float64)
    else:
        filtered = input
    (output, return_value) = _ni_support._get_output(output, input, output_type, shape=output_shape)
    _nd_image.geometric_transform(filtered, None, coordinates, None, None, output, order, mode, cval, None, None)
    return return_value
Map the input array to new coordinates by interpolation.

The array of coordinates is used to find, for each point in the output,
the corresponding coordinates in the input. The value of the input at
those coordinates is determined by spline interpolation of the
requested order.

The shape of the output is derived from that of the coordinate
array by dropping the first axis. The values of the array along
the first axis are the coordinates in the input array at which the
output value is found.

Parameters
----------
input : ndarray
        The input array
coordinates : array_like
              The coordinates at which `input` is evaluated.
output_type : deprecated
              Use `output` instead.
output : dtype, optional
         If the output has to have a certain type, specify the dtype.
         The default behavior is for the output to have the same type
         as `input`.
order : int, optional
        The order of the spline interpolation, default is 3.
        The order has to be in the range 0-5.
mode : str, optional
       Points outside the boundaries of the input are filled according
       to the given mode ('constant', 'nearest', 'reflect' or 'wrap').
       Default is 'constant'.
cval : scalar, optional
       Value used for points outside the boundaries of the input if
       `mode='constant`. Default is 0.0
prefilter : bool, optional
            The parameter prefilter determines if the input is
            pre-filtered with `spline_filter`_ before interpolation
            (necessary for spline interpolation of order > 1).
            If False, it is assumed that the input is already filtered.

Returns
-------
return_value : ndarray
               The result of transforming the input. The shape of the
               output is derived from that of `coordinates` by dropping
               the first axis.


See Also
--------
spline_filter, geometric_transform, scipy.interpolate

Examples
--------
>>> import scipy.ndimage
>>> a = np.arange(12.).reshape((4,3))
>>> print a
array([[  0.,   1.,   2.],
       [  3.,   4.,   5.],
       [  6.,   7.,   8.],
       [  9.,  10.,  11.]])
>>> sp.ndimage.map_coordinates(a, [[0.5, 2], [0.5, 1]], order=1)
[ 2.  7.]

Above, the interpolated value of a[0.5, 0.5] gives output[0], while
a[2, 1] is output[1].

>>> inds = np.array([[0.5, 2], [0.5, 4]])
>>> sp.ndimage.map_coordinates(a, inds, order=1, cval=-33.3)
array([  2. , -33.3])
>>> sp.ndimage.map_coordinates(a, inds, order=1, mode='nearest')
array([ 2.,  8.])
>>> sp.ndimage.map_coordinates(a, inds, order=1, cval=0, output=bool)
array([ True, False], dtype=bool
def map_coordinates(input, coordinates, output_type=None, output=None, order=3, mode='constant', cval=0.0, prefilter=True):
    "\n    Map the input array to new coordinates by interpolation.\n\n    The array of coordinates is used to find, for each point in the output,\n    the corresponding coordinates in the input. The value of the input at\n    those coordinates is determined by spline interpolation of the\n    requested order.\n\n    The shape of the output is derived from that of the coordinate\n    array by dropping the first axis. The values of the array along\n    the first axis are the coordinates in the input array at which the\n    output value is found.\n\n    Parameters\n    ----------\n    input : ndarray\n            The input array\n    coordinates : array_like\n                  The coordinates at which `input` is evaluated.\n    output_type : deprecated\n                  Use `output` instead.\n    output : dtype, optional\n             If the output has to have a certain type, specify the dtype.\n             The default behavior is for the output to have the same type\n             as `input`.\n    order : int, optional\n            The order of the spline interpolation, default is 3.\n            The order has to be in the range 0-5.\n    mode : str, optional\n           Points outside the boundaries of the input are filled according\n           to the given mode ('constant', 'nearest', 'reflect' or 'wrap').\n           Default is 'constant'.\n    cval : scalar, optional\n           Value used for points outside the boundaries of the input if\n           `mode='constant`. Default is 0.0\n    prefilter : bool, optional\n                The parameter prefilter determines if the input is\n                pre-filtered with `spline_filter`_ before interpolation\n                (necessary for spline interpolation of order > 1).\n                If False, it is assumed that the input is already filtered.\n\n    Returns\n    -------\n    return_value : ndarray\n                   The result of transforming the input. The shape of the\n                   output is derived from that of `coordinates` by dropping\n                   the first axis.\n\n\n    See Also\n    --------\n    spline_filter, geometric_transform, scipy.interpolate\n\n    Examples\n    --------\n    >>> import scipy.ndimage\n    >>> a = np.arange(12.).reshape((4,3))\n    >>> print a\n    array([[  0.,   1.,   2.],\n           [  3.,   4.,   5.],\n           [  6.,   7.,   8.],\n           [  9.,  10.,  11.]])\n    >>> sp.ndimage.map_coordinates(a, [[0.5, 2], [0.5, 1]], order=1)\n    [ 2.  7.]\n\n    Above, the interpolated value of a[0.5, 0.5] gives output[0], while\n    a[2, 1] is output[1].\n\n    >>> inds = np.array([[0.5, 2], [0.5, 4]])\n    >>> sp.ndimage.map_coordinates(a, inds, order=1, cval=-33.3)\n    array([  2. , -33.3])\n    >>> sp.ndimage.map_coordinates(a, inds, order=1, mode='nearest')\n    array([ 2.,  8.])\n    >>> sp.ndimage.map_coordinates(a, inds, order=1, cval=0, output=bool)\n    array([ True, False], dtype=bool\n\n    "
    if ((order < 0) or (order > 5)):
        raise RuntimeError('spline order not supported')
    input = numpy.asarray(input)
    if numpy.iscomplexobj(input):
        raise TypeError('Complex type not supported')
    coordinates = numpy.asarray(coordinates)
    if numpy.iscomplexobj(coordinates):
        raise TypeError('Complex type not supported')
    output_shape = coordinates.shape[1:]
    if ((input.ndim < 1) or (len(output_shape) < 1)):
        raise RuntimeError('input and output rank must be > 0')
    if (coordinates.shape[0] != input.ndim):
        raise RuntimeError('invalid shape for coordinate array')
    mode = _extend_mode_to_code(mode)
    if (prefilter and (order > 1)):
        filtered = spline_filter(input, order, output=numpy.float64)
    else:
        filtered = input
    (output, return_value) = _ni_support._get_output(output, input, output_type, shape=output_shape)
    _nd_image.geometric_transform(filtered, None, coordinates, None, None, output, order, mode, cval, None, None)
    return return_value