def union_mask(filelist):
firstimg = check_img(filelist[<NUM_LIT:0>])<EOL>mask     = np.zeros_like(firstimg.get_data())<EOL>try:<EOL><INDENT>for volf in filelist:<EOL><INDENT>roiimg = check_img(volf)<EOL>check_img_compatibility(firstimg, roiimg)<EOL>mask  += get_img_data(roiimg)<EOL><DEDENT><DEDENT>except Exception as exc:<EOL><INDENT>raise ValueError('<STR_LIT>'.format(repr_imgs(firstimg), repr_imgs(volf))) from exc<EOL><DEDENT>else:<EOL><INDENT>return as_ndarray(mask > <NUM_LIT:0>, dtype=bool)<EOL><DEDENT>
Creates a binarised mask with the union of the files in filelist.

Parameters
----------
filelist: list of img-like object or boyle.nifti.NeuroImage or str
    List of paths to the volume files containing the ROIs.
    Can either be:
    - a file path to a Nifti image
    - any object with get_data() and get_affine() methods, e.g., nibabel.Nifti1Image.
    If niimg is a string, consider it as a path to Nifti image and
    call nibabel.load on it. If it is an object, check if get_data()
    and get_affine() methods are present, raise TypeError otherwise.

Returns
-------
ndarray of bools
    Mask volume

Raises
------
ValueError