(init_level_set, image_shape)
return res
Auxiliary function for initializing level sets with a string.

    If `init_level_set` is not a string, it is returned as is.
Auxiliary function for initializing level sets with a string.
Auxiliary function for initializing level sets with a string .
def _init_level_set(init_level_set, image_shape):
    """Auxiliary function for initializing level sets with a string.

    If `init_level_set` is not a string, it is returned as is.
    """
    if isinstance(init_level_set, str):
        if init_level_set == 'checkerboard':
            res = checkerboard_level_set(image_shape)
        elif init_level_set == 'circle':
            res = circle_level_set(image_shape)
        elif init_level_set == 'ellipsoid':
            res = ellipsoid_level_set(image_shape)
        else:
            raise ValueError("`init_level_set` not in "
                             "['checkerboard', 'circle', 'ellipsoid']")
    else:
        res = init_level_set
    return res
def _init_level_set ( init_level_set , image_shape ) : if isinstance ( init_level_set , str ) : if init_level_set == 'checkerboard' : res = checkerboard_level_set ( image_shape ) elif init_level_set == 'circle' : res = circle_level_set ( image_shape ) elif init_level_set == 'ellipsoid' : res = ellipsoid_level_set ( image_shape ) else : raise ValueError ( "`init_level_set` not in " "['checkerboard', 'circle', 'ellipsoid']" ) else : res = init_level_set return res