Get spatial point from index of an image.

    ANTsR function: `antsTransformIndexToPhysicalPoint`

    Arguments
    ---------
    img : ANTsImage
        image to get values from

    index : list or tuple or numpy.ndarray
        location in image

    Returns
    -------
    tuple

    Example
    -------
    >>> import ants
    >>> import numpy as np
    >>> img = ants.make_image((10,10),np.random.randn(100))
    >>> pt = ants.transform_index_to_physical_point(img, (2,2))

def transform_index_to_physical_point(image, index):
    """
    Get spatial point from index of an image.

    ANTsR function: `antsTransformIndexToPhysicalPoint`

    Arguments
    ---------
    img : ANTsImage
        image to get values from

    index : list or tuple or numpy.ndarray
        location in image

    Returns
    -------
    tuple

    Example
    -------
    >>> import ants
    >>> import numpy as np
    >>> img = ants.make_image((10,10),np.random.randn(100))
    >>> pt = ants.transform_index_to_physical_point(img, (2,2))
    """
    if not isinstance(image, iio.ANTsImage):
        raise ValueError('image must be ANTsImage type')

    if isinstance(index, np.ndarray):
        index = index.tolist()

    if not isinstance(index, (tuple,list)):
        raise ValueError('index must be tuple or list')

    if len(index) != image.dimension:
        raise ValueError('len(index) != image.dimension')

    index = [i+1 for i in index]
    ndim = image.dimension
    ptype = image.pixeltype
    libfn = utils.get_lib_fn('TransformIndexToPhysicalPoint%s%i' % (utils.short_ptype(ptype), ndim))
    point = libfn(image.pointer, [list(index)])

    return np.array(point[0])