def _calc_target_bounding_box(bbox, source_shape, target_shape):
    """Calculates the bounding of the cropped target image.

    ``bbox`` is relative to the shape of the source image. For the target
    image, the number of pixels on the left is equal to the absolute value of
    the negative start (if any), and the number of pixels on the right is equal
    to the number of pixels target size exceeding the source size.

    Args:
        bbox (tuple[slice]): The len==3 bounding box for the cropping. The start
            of the slice can be negative, meaning to pad zeros on the left; the
            stop of the slice can be greater than the size of the image along
            this direction, meaning to pad zeros on the right.
        source_shape (tuple[int]): The spatial shape of the image to crop.
        target_shape (tuple[int]): The spatial shape of the cropped image.

    Returns:
        tuple[slice]: The bounding box of the cropped image used to put the
            extracted data from the source image into the traget image.

    """
    target_bbox = list()
    for bounding, ssize, tsize in zip(bbox, source_shape, target_shape):
        target_start = 0 - min(bounding.start, 0)
        target_stop = tsize - max(bounding.stop - ssize, 0)
        target_bbox.append(slice(target_start, target_stop, None))
    return tuple(target_bbox)