def valid_tile_size(value, arg_name, min_power=4, logger=None):
    """
    Verifies that the tile size is defined as an integer in [16, 32, 64, 128, 256, 512, 1024, 2048, 4096].

    :param value:     int, tile size
    :param arg_name:  str, parameter name
    :param min_power: int, 2^min_power as minimum tile size (consistency with the number of downsampling layers)
    :param logger:    logger instance
    :return:          boolean, True if the tile size is correctly defined, False otherwise
    """

    error = False

    if not isinstance(value, int):
        if logger:
            logger.error(f"Invalid value for the argument {arg_name}: {value}. Enter an integer.\n")
        else:
            print(f"ERROR: Invalid value for the argument {arg_name}: {value}. Enter an integer.\n")
        error = True
    if value not in [2 ** i for i in range(min_power, 12)]:
        if logger:
            logger.error(f"Invalid value for the argument {arg_name}: {value}. Choose among "
                         f"{[2 ** i for i in range(min_power, 12)]}.\n")
        else:
            print(f"ERROR: Invalid value for the argument {arg_name}: {value}. Choose among "
                  f"{[2 ** i for i in range(min_power, 12)]}.\n")
        error = True

    return not error