def crop_center(shape_in, shape_out):
    """Crop input images to desired output shape.

    Args:
        shape_in (tuple): Input shape.
        shape_out (tuple): Output shape.

    Returns:
        tuple: indices to slice image array.
    """

    slices = []
    for length, delta in zip(shape_in, shape_out):
        assert isinstance(length, int), "shape_in must be a tuple of ints."
        assert isinstance(delta, int), "shape_out must be a tuple of ints."
        assert length >= delta, "Cropped shape cannot be larger than input shape."
        assert (length - delta) % 2 == 0, \
            "Cropped shape cannot be centered given input and output shapes."

        start = length // 2 - delta // 2
        slices.append((start, start + delta))

    return tuple(slices)