Create a proper ANTsImage sub-image by indexing the image with indices. 
    This is similar to but different from array sub-setting in that 
    the resulting sub-image can be decropped back into its place without 
    having to store its original index locations explicitly.
    
    ANTsR function: `cropIndices`

    Arguments
    ---------
    image : ANTsImage  
        image to crop
    
    lowerind : list/tuple of integers  
        vector of lower index, should be length image dimensionality
    
    upperind : list/tuple of integers
        vector of upper index, should be length image dimensionality
    
    Returns
    -------
    ANTsImage

    Example
    -------
    >>> import ants
    >>> fi = ants.image_read( ants.get_ants_data("r16"))
    >>> cropped = ants.crop_indices( fi, (10,10), (100,100) )
    >>> cropped = ants.smooth_image( cropped, 5 )
    >>> decropped = ants.decrop_image( cropped, fi )

def crop_indices(image, lowerind, upperind):
    """
    Create a proper ANTsImage sub-image by indexing the image with indices. 
    This is similar to but different from array sub-setting in that 
    the resulting sub-image can be decropped back into its place without 
    having to store its original index locations explicitly.
    
    ANTsR function: `cropIndices`

    Arguments
    ---------
    image : ANTsImage  
        image to crop
    
    lowerind : list/tuple of integers  
        vector of lower index, should be length image dimensionality
    
    upperind : list/tuple of integers
        vector of upper index, should be length image dimensionality
    
    Returns
    -------
    ANTsImage

    Example
    -------
    >>> import ants
    >>> fi = ants.image_read( ants.get_ants_data("r16"))
    >>> cropped = ants.crop_indices( fi, (10,10), (100,100) )
    >>> cropped = ants.smooth_image( cropped, 5 )
    >>> decropped = ants.decrop_image( cropped, fi )
    """
    inpixeltype = 'float'
    if image.pixeltype != 'float':
        inpixeltype = image.pixeltype
        image = image.clone('float')

    if (image.dimension != len(lowerind)) or (image.dimension != len(upperind)):
        raise ValueError('image dimensionality and index length must match')

    libfn = utils.get_lib_fn('cropImageF%i' % image.dimension)
    itkimage = libfn(image.pointer, image.pointer, 1, 2, lowerind, upperind)
    ants_image = iio.ANTsImage(pixeltype='float', dimension=image.dimension,
                        components=image.components, pointer=itkimage)
    if inpixeltype != 'float':
        ants_image = ants_image.clone(inpixeltype)
    return ants_image