def bar(edges, shape, horizontal=True, values=None):
    """Draw bars defined by `edges` from one edge to the other of `image_shape`

    Bars will be horizontal or vertical depending on the value of `horizontal`

    Parameters
    ----------
    edges : list
        List of tuples of inner (left or top) and outer (right or bottom)
        edges of each bar.
        e.g., edges=[(1, 2), (11, 12), (21, 22)]
    shape : tuple
        Shape of the image in which to create the ROIs
        e.g., shape=(512, 512)
    horizontal : bool, optional
        True: Make horizontal bars
        False: Make vertical bars
        Defaults to True
    values : array, optional
        image pixels co-ordinates

    Returns
    -------
    label_array : array
        Elements not inside any ROI are zero; elements inside each
        ROI are 1, 2, 3, corresponding to the order they are
        specified in `edges`.
        Has shape=`image shape`

    Note
    ----
    The primary use case is in GISAXS.
    """
    edges = np.atleast_2d(np.asarray(edges)).ravel()
    if not 0 == len(edges) % 2:
        raise ValueError("edges should have an even number of elements, "
                         "giving inner, outer edge value for each bar")
    if not np.all(np.diff(edges) >= 0):
        raise ValueError("edges are expected to be monotonically increasing, "
                         "giving inner and outer radii of each bar from "
                         "r=0 outward")
    if values is None:
        values = np.repeat(range(shape[0]), shape[1])
    if not horizontal:
        values = np.tile(range(shape[1]), shape[0])

    return _make_roi(values, edges, shape)
dataset/ETHPy150Open scikit-beam/scikit-beam/skbeam/core/roi.py/bar/original