def region_of_interest(images, x0=0, x1=None, y0=0, y1=None):
    """
    Crop all images in a stack to the desired shape.

    This function changes the images in the stack.
    If the input images should be preserved copy the input to a separate object before!

    The coordinate system is the following: x0->x1 = width, y0->y1 = height from the top left corner of the image

    Parameters
    ----------
    images: list, ImageStack
    x0: int
    x1: int
    y0: int
    y1: int

    Returns
    -------
    out: list, ImageStack
        ImageStack or list with the cropped images
    """
    for ind, img in enumerate(images):
        images[ind] = img[y0:y1, x0:x1]
    return images