def expandBoundingBox(bboxCoordinates, win_xy, win_z):
    """
    Expand boundingbox dict by specified amount.
    Checks for boundary issues so it's not garunteed
    to be completely centered around an annotation.

    Paramters
    -------------
    bboxCoordinates : dict
    win_xy : int - amount to expand by in the x,y dimensions
    win_z : int - number of slices to search
    """
    # check for boundary issues
    startZ = bboxCoordinates['minZ']
    if (startZ - win_z > -1):
        startZ = startZ - win_z

    endZ = bboxCoordinates['maxZ']
    if (endZ + win_z < 101):
        endZ = endZ + win_z

    # get range of x, y values
    startX = bboxCoordinates['minX'] - win_xy
    startY = bboxCoordinates['minY'] - win_xy
    deltaX = bboxCoordinates['maxX'] - startX + win_xy
    deltaY = bboxCoordinates['maxY'] - startY + win_xy

    startX = int(round(startX))
    startY = int(round(startY))
    deltaX = int(round(deltaX))
    deltaY = int(round(deltaY))
    startZ = int(round(startZ))
    endZ = int(round(endZ))

    expandedBox = {'startX': startX, 'deltaX': deltaX,
                   'startY': startY, 'deltaY': deltaY,
                   'startZ': startZ, 'endZ': endZ}
    return expandedBox