(image_shape, square_size=5)
return res
Create a checkerboard level set with binary values.

    Parameters
    ----------
    image_shape : tuple of positive integers
        Shape of the image.
    square_size : int, optional
        Size of the squares of the checkerboard. It defaults to 5.

    Returns
    -------
    out : array with shape `image_shape`
        Binary level set of the checkerboard.

    See also
    --------
    circle_level_set
Create a checkerboard level set with binary values.
Create a checkerboard level set with binary values .
def checkerboard_level_set(image_shape, square_size=5):
    """Create a checkerboard level set with binary values.

    Parameters
    ----------
    image_shape : tuple of positive integers
        Shape of the image.
    square_size : int, optional
        Size of the squares of the checkerboard. It defaults to 5.

    Returns
    -------
    out : array with shape `image_shape`
        Binary level set of the checkerboard.

    See also
    --------
    circle_level_set
    """

    grid = np.ogrid[[slice(i) for i in image_shape]]
    grid = [(grid_i // square_size) & 1 for grid_i in grid]

    checkerboard = np.bitwise_xor.reduce(grid, axis=0)
    res = np.int8(checkerboard)
    return res
def checkerboard_level_set ( image_shape , square_size = 5 ) : grid = np . ogrid [ [ slice ( i ) for i in image_shape ] ] grid = [ ( grid_i // square_size ) & 1 for grid_i in grid ] checkerboard = np . bitwise_xor . reduce ( grid , axis = 0 ) res = np . int8 ( checkerboard ) return res