Get mask.

    Parameters
    ----------
    region : `~pyregion.ShapeList`
        List of `~pyregion.Shape`
    hdu : `~astropy.io.fits.ImageHDU`
        FITS image HDU
    origin : float
        TODO: document me

    Returns
    -------
    mask : `~numpy.array`
        Boolean mask

    Examples
    --------
    >>> from astropy.io import fits
    >>> from pyregion import read_region_as_imagecoord, get_mask
    >>> hdu = fits.open("test.fits")[0]
    >>> region = "test01.reg"
    >>> reg = read_region_as_imagecoord(open(region), f[0].header)
    >>> mask = get_mask(reg, hdu)

def get_mask(region, hdu, origin=1):
    """Get mask.

    Parameters
    ----------
    region : `~pyregion.ShapeList`
        List of `~pyregion.Shape`
    hdu : `~astropy.io.fits.ImageHDU`
        FITS image HDU
    origin : float
        TODO: document me

    Returns
    -------
    mask : `~numpy.array`
        Boolean mask

    Examples
    --------
    >>> from astropy.io import fits
    >>> from pyregion import read_region_as_imagecoord, get_mask
    >>> hdu = fits.open("test.fits")[0]
    >>> region = "test01.reg"
    >>> reg = read_region_as_imagecoord(open(region), f[0].header)
    >>> mask = get_mask(reg, hdu)
    """
    from pyregion.region_to_filter import as_region_filter

    data = hdu.data
    region_filter = as_region_filter(region, origin=origin)
    mask = region_filter.mask(data)
    return mask